aboutsummaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2007-05-07 01:10:07 +0200
committerJunio C Hamano <junkio@cox.net>2007-05-07 18:20:19 -0700
commitfb1dde4a908ddcfaa884f67734a60dc6bd639b59 (patch)
tree53f34f91fbd3cfcbf7fa34166ae494af1e58cc82 /gitweb
parent493e01db51ae003255a27dbcc81953fbfdab958a (diff)
downloadgit-fb1dde4a908ddcfaa884f67734a60dc6bd639b59.tar.gz
git-fb1dde4a908ddcfaa884f67734a60dc6bd639b59.tar.xz
gitweb: Show combined diff for merge commits in 'commitdiff' view
When 'commitdiff' action is requested without 'hp' (hash parent) parameter, and commit given by 'h' (hash) parameter is merge commit, show merge as combined diff. Earlier for merge commits without 'hp' parameter diff to first parent was shown. Note that in compact combined (--cc) format 'uninteresting' hunks omission mechanism can make that there is no patch corresponding to line in raw format (difftree) output. That is why (at least for now) we use --combined and not --cc format for showing commitdiff for merge commits. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl12
1 files changed, 7 insertions, 5 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b3e2e07a2..c0e2473b4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4391,8 +4391,10 @@ sub git_commitdiff {
}
}
+ my $hash_parent_param = $hash_parent;
if (!defined $hash_parent) {
- $hash_parent = $co{'parent'} || '--root';
+ $hash_parent_param =
+ @{$co{'parents'}} > 1 ? '-c' : $co{'parent'} || '--root';
}
# read commitdiff
@@ -4401,7 +4403,7 @@ sub git_commitdiff {
if ($format eq 'html') {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
"--no-commit-id", "--patch-with-raw", "--full-index",
- $hash_parent, $hash, "--"
+ $hash_parent_param, $hash, "--"
or die_error(undef, "Open git-diff-tree failed");
while (my $line = <$fd>) {
@@ -4413,7 +4415,7 @@ sub git_commitdiff {
} elsif ($format eq 'plain') {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
- '-p', $hash_parent, $hash, "--"
+ '-p', $hash_parent_param, $hash, "--"
or die_error(undef, "Open git-diff-tree failed");
} else {
@@ -4469,10 +4471,10 @@ TEXT
# write patch
if ($format eq 'html') {
- git_difftree_body(\@difftree, $hash, $hash_parent);
+ git_difftree_body(\@difftree, $hash, $hash_parent || @{$co{'parents'}});
print "<br/>\n";
- git_patchset_body($fd, \@difftree, $hash, $hash_parent);
+ git_patchset_body($fd, \@difftree, $hash, $hash_parent || @{$co{'parents'}});
close $fd;
print "</div>\n"; # class="page_body"
git_footer_html();