gitweb: Show combined diff for merge commits in 'commit' view
When commit shown is a merge commit (has more than one parent), display combined difftree output (result of git-diff-tree -c). Earlier (since commit 549ab4a30703012ff3a12b5455d319216805a8db) difftree output (against first parent) was not printed for merges. Examples of non-trivial merges: 5bac4a671907604b5fb4e24ff682d5b0e8431931 (includes rename) addafaf92eeb86033da91323d0d3ad7a496dae83 (five parents) 95f97567c1887d77f3a46b42d8622c76414d964d (evil merge) Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
May 7, 2007 at 01:10 UTC
208ecb2e860364aeffb22eb1f644db077b1c5162
1 file changed
+8
-12
gitweb/gitweb.perl
+8
-12
@@ -4026,14 +4026,13 @@ sub git_commit {
4026
$parent = "--root";
4027
}
4028
my @difftree;
4029
- if (@$parents <= 1) {
4030
- # difftree output is not printed for merges
4031
- open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
4032
- @diff_opts, $parent, $hash, "--"
4033
- or die_error(undef, "Open git-diff-tree failed");
4034
- @difftree = map { chomp; $_ } <$fd>;
4035
- close $fd or die_error(undef, "Reading git-diff-tree failed");
4036
- }
4029
+ open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
4030
+ @diff_opts,
4031
+ (@$parents <= 1 ? $parent : '-c'),
4032
+ $hash, "--"
4033
+ or die_error(undef, "Open git-diff-tree failed");
4034
+ @difftree = map { chomp; $_ } <$fd>;
4035
+ close $fd or die_error(undef, "Reading git-diff-tree failed");
4036
4037
# non-textual hash id's can be cached
4038
my $expires;
@@ -4111,10 +4110,7 @@ sub git_commit {
4110
git_print_log($co{'comment'});
4111
print "</div>\n";
4112
4114
- if (@$parents <= 1) {
4115
- # do not output difftree/whatchanged for merges
4116
- git_difftree_body(\@difftree, $hash, $parent);
4117
- }
4113
+ git_difftree_body(\@difftree, $hash, @$parents);
4114
4115
git_footer_html();
4116
}