@matheusbsbs / matheus-bagliano / commits / 241cc599b3
Fork 0

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>

Jakub Narebski committed Oct 31, 2006 at 17:36 UTC 241cc599b342663877a8f468513c77518c94d96f
1 file changed +26 -33
gitweb/gitweb.perl
+26 -33
@@ -1986,19 +1986,19 @@ sub git_difftree_body {
1986 print "</td>\n";
1987 print "<td>$mode_chnge</td>\n";
1988 print "<td class=\"link\">";
1989 - if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
1990 - if ($action eq 'commitdiff') {
1991 - # link to patch
1992 - $patchno++;
1993 - print $cgi->a({-href => "#patch$patchno"}, "patch");
1994 - } else {
1995 - print $cgi->a({-href => href(action=>"blobdiff",
1996 - hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1997 - hash_base=>$hash, hash_parent_base=>$parent,
1998 - file_name=>$diff{'file'})},
1999 - "diff");
2000 - }
2001 - print " | ";
1989 + if ($action eq 'commitdiff') {
1990 + # link to patch
1991 + $patchno++;
1992 + print $cgi->a({-href => "#patch$patchno"}, "patch") .
1993 + " | ";
1994 + } elsif ($diff{'to_id'} ne $diff{'from_id'}) {
1995 + # "commit" view and modified file (not onlu mode changed)
1996 + print $cgi->a({-href => href(action=>"blobdiff",
1997 + hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1998 + hash_base=>$hash, hash_parent_base=>$parent,
1999 + file_name=>$diff{'file'})},
2000 + "diff") .
2001 + " | ";
2002 }
2003 print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
2004 hash_base=>$hash, file_name=>$diff{'file'})},
@@ -2029,19 +2029,19 @@ sub git_difftree_body {
2029 -class => "list"}, esc_html($diff{'from_file'})) .
2030 " with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" .
2031 "<td class=\"link\">";
2032 - if ($diff{'to_id'} ne $diff{'from_id'}) {
2033 - if ($action eq 'commitdiff') {
2034 - # link to patch
2035 - $patchno++;
2036 - print $cgi->a({-href => "#patch$patchno"}, "patch");
2037 - } else {
2038 - print $cgi->a({-href => href(action=>"blobdiff",
2039 - hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
2040 - hash_base=>$hash, hash_parent_base=>$parent,
2041 - file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
2042 - "diff");
2043 - }
2044 - print " | ";
2032 + if ($action eq 'commitdiff') {
2033 + # link to patch
2034 + $patchno++;
2035 + print $cgi->a({-href => "#patch$patchno"}, "patch") .
2036 + " | ";
2037 + } elsif ($diff{'to_id'} ne $diff{'from_id'}) {
2038 + # "commit" view and modified file (not only pure rename or copy)
2039 + print $cgi->a({-href => href(action=>"blobdiff",
2040 + hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
2041 + hash_base=>$hash, hash_parent_base=>$parent,
2042 + file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
2043 + "diff") .
2044 + " | ";
2045 }
2046 print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
2047 hash_base=>$parent, file_name=>$diff{'from_file'})},
@@ -2092,13 +2092,6 @@ sub git_patchset_body {
2092 }
2093 $patch_idx++;
2094
2095 - # for now, no extended header, hence we skip empty patches
2096 - # companion to next LINE if $in_header;
2097 - if ($diffinfo->{'from_id'} eq $diffinfo->{'to_id'}) { # no change
2098 - $in_header = 1;
2099 - next LINE;
2100 - }
2101 -
2095 if ($diffinfo->{'status'} eq "A") { # added
2096 print "<div class=\"diff_info\">" . file_type($diffinfo->{'to_mode'}) . ":" .
2097 $cgi->a({-href => href(action=>"blob", hash_base=>$hash,