From: Junio C Hamano <junkio@cox.net>
To: Kay Sievers <kay.sievers@suse.de>
Cc: Linus Torvalds <torvalds@osdl.org>, git@vger.kernel.org
Subject: [PATCH] Allow using --cc when showing a merge.
Date: Wed, 08 Feb 2006 16:02:13 -0800 [thread overview]
Message-ID: <7vhd79mmbe.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vu0b9mmij.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Wed, 08 Feb 2006 15:57:56 -0800")
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* This does not do the colorized diff, but just to show ideas
where to put the link to ask for the combined diff.
gitweb.cgi | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 47 insertions(+), 13 deletions(-)
1f19febaefbf90dc04a6b37d79ba3a9337decaff
diff --git a/gitweb.cgi b/gitweb.cgi
index c1bb624..d2659ea 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -191,6 +191,9 @@ if (!defined $action || $action eq "summ
} elsif ($action eq "commitdiff_plain") {
git_commitdiff_plain();
exit;
+} elsif ($action eq "combinediff") {
+ git_combinediff();
+ exit;
} elsif ($action eq "history") {
git_history();
exit;
@@ -1762,7 +1765,15 @@ sub git_commit {
"</tr>\n";
print "<tr><td>committer</td><td>" . esc_html($co{'committer'}) . "</td></tr>\n";
print "<tr><td></td><td> $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
- print "<tr><td>commit</td><td style=\"font-family:monospace\">$co{'id'}</td></tr>\n";
+ print "<tr><td>commit</td><td style=\"font-family:monospace\">$co{'id'}</td>";
+ if (1 < @{$co{'parents'}}) {
+ print '<td class="link">';
+ print $cgi->a({-href => "$my_uri?" .
+ esc_param("p=$project;a=combinediff;".
+ "h=$hash")}, "combinediff");
+ print '</td>';
+ }
+ print "</tr>\n";
print "<tr>" .
"<td>tree</td>" .
"<td style=\"font-family:monospace\">" .
@@ -2044,6 +2055,38 @@ sub git_commitdiff {
git_footer_html();
}
+sub git_combinediff {
+ mkdir($git_temp, 0700);
+ my $fd;
+ my $refs = read_info_ref("tags");
+ open $fd, "-|", "$gitbin/git-describe $hash";
+ my ($tagname) = <$fd>;
+ chomp($tagname);
+ close $fd;
+ print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
+ my %co = git_read_commit($hash);
+ my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
+ my $comment = $co{'comment'};
+ print "From: $co{'author'}\n" .
+ "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n".
+ "Subject: $co{'title'}\n";
+ if (defined $tagname) {
+ print "X-Git-Tag: $tagname\n";
+ }
+ print "\n";
+
+ foreach my $line (@$comment) {;
+ print "$line\n";
+ }
+ print "---\n\n";
+
+ open $fd, "-|", "$gitbin/git-diff-tree --cc $hash";
+ while (<$fd>) {
+ print $_;
+ }
+ close $fd;
+}
+
sub git_commitdiff_plain {
mkdir($git_temp, 0700);
open my $fd, "-|", "$gitbin/git-diff-tree -r $hash_parent $hash" or die_error(undef, "Open failed.");
@@ -2051,20 +2094,11 @@ sub git_commitdiff_plain {
close $fd or die_error(undef, "Reading diff-tree failed.");
# try to figure out the next tag after this commit
- my $tagname;
my $refs = read_info_ref("tags");
- open $fd, "-|", "$gitbin/git-rev-list HEAD";
- chomp (my (@commits) = <$fd>);
+ open $fd, "-|", "$gitbin/git-describe $hash";
+ my ($tagname) = <$fd>;
+ chomp($tagname);
close $fd;
- foreach my $commit (@commits) {
- if (defined $refs->{$commit}) {
- $tagname = $refs->{$commit}
- }
- if ($commit eq $hash) {
- last;
- }
- }
-
print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
my %co = git_read_commit($hash);
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
--
1.1.6.gbb042
next prev parent reply other threads:[~2006-02-09 0:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 23:44 gitweb using "--cc"? Linus Torvalds
2006-02-08 23:57 ` Junio C Hamano
2006-02-09 0:01 ` [PATCH] Use describe to come up with the closest tag Junio C Hamano
2006-02-09 0:02 ` Junio C Hamano [this message]
2006-02-09 2:13 ` gitweb using "--cc"? Brian Gerst
2006-02-09 2:26 ` Linus Torvalds
2006-02-09 3:14 ` Junio C Hamano
2006-02-09 16:35 ` Linus Torvalds
2006-02-09 16:42 ` Linus Torvalds
2006-02-09 18:30 ` Linus Torvalds
2006-02-09 19:41 ` Junio C Hamano
2006-02-09 20:27 ` Linus Torvalds
2006-02-09 20:37 ` Linus Torvalds
2006-02-09 20:47 ` Junio C Hamano
2006-02-09 20:52 ` Junio C Hamano
2006-02-09 21:53 ` Junio C Hamano
2006-02-09 22:00 ` Junio C Hamano
2006-02-09 22:26 ` Junio C Hamano
2006-02-11 9:17 ` Marco Costalba
2006-02-11 19:32 ` Junio C Hamano
2006-02-11 20:59 ` Junio C Hamano
2006-02-09 20:38 ` Junio C Hamano
2006-02-09 20:50 ` Linus Torvalds
2006-02-09 21:11 ` Junio C Hamano
2006-02-10 11:00 ` [PATCH] combine-diff: Record diff status a bit more faithfully Junio C Hamano
2006-02-09 23:49 ` [PATCH] combine-diff: move formatting logic to show_combined_diff() Junio C Hamano
2006-02-09 3:13 ` gitweb using "--cc"? Kay Sievers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vhd79mmbe.fsf_-_@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=kay.sievers@suse.de \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).