summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fba20b4)
raw | patch | inline | side by side (parent: fba20b4)
author | Jakub Narebski <jnareb@gmail.com> | |
Mon, 28 Aug 2006 12:48:14 +0000 (14:48 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 28 Aug 2006 23:21:35 +0000 (16:21 -0700) |
Added/uncommented git_difftree_body invocation in git_commitdiff.
Added anchors (via 'id' attribute) to patches in patchset.
git_difftree_body is modified to link to patch anchor when called from
git_commitdiff, instead of link to blobdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Added anchors (via 'id' attribute) to patches in patchset.
git_difftree_body is modified to link to patch anchor when called from
git_commitdiff, instead of link to blobdiff.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 24c2fe2a1b552b6f6d520be04ca267247c136c83..1b352cbb25c525159d06a3c1c2e67f7524a02ff3 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
print "<table class=\"diff_tree\">\n";
my $alternate = 0;
+ my $patchno = 0;
foreach my $line (@{$difftree}) {
my %diff = parse_difftree_raw_line($line);
"<td class=\"link\">" .
$cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'})},
- "blob") .
- "</td>\n";
+ "blob");
+ if ($action == "commitdiff") {
+ # link to patch
+ $patchno++;
+ print " | " .
+ $cgi->a({-href => "#patch$patchno"}, "patch");
+ }
+ print "</td>\n";
} elsif ($diff{'status'} eq "D") { # deleted
my $mode_chng = "<span class=\"file_status deleted\">[deleted $from_file_type]</span>";
$cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
hash_base=>$parent, file_name=>$diff{'file'})},
"blob") .
- " | " .
- $cgi->a({-href => href(action=>"history", hash_base=>$parent,
+ " | ";
+ if ($action == "commitdiff") {
+ # link to patch
+ $patchno++;
+ print " | " .
+ $cgi->a({-href => "#patch$patchno"}, "patch");
+ }
+ print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'file'})},
"history") .
"</td>\n";
print "</td>\n" .
"<td>$mode_chnge</td>\n" .
"<td class=\"link\">" .
- $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
- hash_base=>$hash, file_name=>$diff{'file'})},
- "blob");
+ $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+ hash_base=>$hash, file_name=>$diff{'file'})},
+ "blob");
if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
- 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");
+ if ($action == "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 " | " .
$cgi->a({-href => href(action=>"history",
hash=>$diff{'to_id'}, file_name=>$diff{'to_file'})},
"blob");
if ($diff{'to_id'} ne $diff{'from_id'}) {
- 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");
+ if ($action == "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 "</td>\n";
# first patch in patchset
$patch_found = 1;
}
- print "<div class=\"patch\">\n";
+ print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n";
if (ref($difftree->[$patch_idx]) eq "HASH") {
$diffinfo = $difftree->[$patch_idx];
# write patch
if ($format eq 'html') {
- #git_difftree_body(\@difftree, $hash, $hash_parent);
- #print "<br/>\n";
+ git_difftree_body(\@difftree, $hash, $hash_parent);
+ print "<br/>\n";
git_patchset_body($fd, \@difftree, $hash, $hash_parent);
close $fd;