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 549ab4a307)
difftree output (against first parent) was not printed for merges.

Examples of non-trivial merges:
  5bac4a6719 (includes rename)
  addafaf92e (five parents)
  95f97567c1 (evil merge)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jakub Narebski 2007-05-07 01:10:08 +02:00 коммит произвёл Junio C Hamano
Родитель fb1dde4a90
Коммит 208ecb2e86
1 изменённых файлов: 8 добавлений и 12 удалений

Просмотреть файл

@ -4026,14 +4026,13 @@ sub git_commit {
$parent = "--root";
}
my @difftree;
if (@$parents <= 1) {
# difftree output is not printed for merges
open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
@diff_opts, $parent, $hash, "--"
or die_error(undef, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed");
}
open my $fd, "-|", git_cmd(), "diff-tree", '-r', "--no-commit-id",
@diff_opts,
(@$parents <= 1 ? $parent : '-c'),
$hash, "--"
or die_error(undef, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed");
# non-textual hash id's can be cached
my $expires;
@ -4111,10 +4110,7 @@ sub git_commit {
git_print_log($co{'comment'});
print "</div>\n";
if (@$parents <= 1) {
# do not output difftree/whatchanged for merges
git_difftree_body(\@difftree, $hash, $parent);
}
git_difftree_body(\@difftree, $hash, @$parents);
git_footer_html();
}