1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 12:36:09 +02:00

gitweb: Output also empty patches in "commitdiff" view

Remove skipping over empty patches (i.e. patches which consist solely
of extended headers) in git_patchset_body, and add links to those
header-only patches in git_difftree_body (but not generate blobdiff
links when there were no change in file contents).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jakub Narebski 2006-10-31 17:36:27 +01:00 committed by Junio C Hamano
parent c954d33da1
commit 241cc599b3

View File

@ -1986,19 +1986,19 @@ sub git_difftree_body {
print "</td>\n";
print "<td>$mode_chnge</td>\n";
print "<td class=\"link\">";
if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
if ($action eq 'commitdiff') {
# link to patch
$patchno++;
print $cgi->a({-href => "#patch$patchno"}, "patch");
} else {
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'})},
"diff");
}
print " | ";
if ($action eq 'commitdiff') {
# link to patch
$patchno++;
print $cgi->a({-href => "#patch$patchno"}, "patch") .
" | ";
} elsif ($diff{'to_id'} ne $diff{'from_id'}) {
# "commit" view and modified file (not onlu mode changed)
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'})},
"diff") .
" | ";
}
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'})},
@ -2029,19 +2029,19 @@ sub git_difftree_body {
-class => "list"}, esc_html($diff{'from_file'})) .
" with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" .
"<td class=\"link\">";
if ($diff{'to_id'} ne $diff{'from_id'}) {
if ($action eq 'commitdiff') {
# link to patch
$patchno++;
print $cgi->a({-href => "#patch$patchno"}, "patch");
} else {
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
"diff");
}
print " | ";
if ($action eq 'commitdiff') {
# link to patch
$patchno++;
print $cgi->a({-href => "#patch$patchno"}, "patch") .
" | ";
} elsif ($diff{'to_id'} ne $diff{'from_id'}) {
# "commit" view and modified file (not only pure rename or copy)
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
"diff") .
" | ";
}
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
hash_base=>$parent, file_name=>$diff{'from_file'})},
@ -2092,13 +2092,6 @@ sub git_patchset_body {
}
$patch_idx++;
# for now, no extended header, hence we skip empty patches
# companion to next LINE if $in_header;
if ($diffinfo->{'from_id'} eq $diffinfo->{'to_id'}) { # no change
$in_header = 1;
next LINE;
}
if ($diffinfo->{'status'} eq "A") { # added
print "<div class=\"diff_info\">" . file_type($diffinfo->{'to_mode'}) . ":" .
$cgi->a({-href => href(action=>"blob", hash_base=>$hash,