Skip to content

Commit 897d1d2

Browse files
jnarebJunio C Hamano
authored andcommitted
gitweb: Finish restoring "blob" links in git_difftree_body
This finishes work started by commit 4777b01 "gitweb: Restore object-named links in item lists" by Petr Baudis. It brings back rest of "blob" links in difftree-raw like part of "commit" and "commitdiff" views, namely in git_difftree_body subroutine. Now the td.link table cell has the following links: * link to diff ("blobdiff" view) in "commit" view, if applicable (there is no link to uninteresting creation/deletion diff), or link to patch anchor in "commitdiff" view. * link to current version of file ("blob" view), with the obvious exception of file deletion, where it is link to the parent version. * link to "blame" view, if it is enabled, and file was not just created (i.e. it has any history). * link to history of the file ("history" view), again with sole exception of the case of new file. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent af6feeb commit 897d1d2

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

gitweb/gitweb.perl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,11 @@ sub git_difftree_body {
20922092
# link to patch
20932093
$patchno++;
20942094
print $cgi->a({-href => "#patch$patchno"}, "patch");
2095+
print " | ";
20952096
}
2097+
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
2098+
hash_base=>$hash, file_name=>$diff{'file'})},
2099+
"blob") . " | ";
20962100
print "</td>\n";
20972101

20982102
} elsif ($diff{'status'} eq "D") { # deleted
@@ -2112,13 +2116,11 @@ sub git_difftree_body {
21122116
}
21132117
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
21142118
hash_base=>$parent, file_name=>$diff{'file'})},
2115-
"blob") . " | ";
2119+
"blob") . " | ";
21162120
if ($have_blame) {
2117-
print $cgi->a({-href =>
2118-
href(action=>"blame",
2119-
hash_base=>$parent,
2120-
file_name=>$diff{'file'})},
2121-
"blame") . " | ";
2121+
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
2122+
file_name=>$diff{'file'})},
2123+
"blame") . " | ";
21222124
}
21232125
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
21242126
file_name=>$diff{'file'})},
@@ -2163,13 +2165,12 @@ sub git_difftree_body {
21632165
" | ";
21642166
}
21652167
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
2166-
hash_base=>$hash, file_name=>$diff{'file'})},
2167-
"blob") . " | ";
2168+
hash_base=>$hash, file_name=>$diff{'file'})},
2169+
"blob") . " | ";
21682170
if ($have_blame) {
2169-
print $cgi->a({-href => href(action=>"blame",
2170-
hash_base=>$hash,
2171-
file_name=>$diff{'file'})},
2172-
"blame") . " | ";
2171+
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
2172+
file_name=>$diff{'file'})},
2173+
"blame") . " | ";
21732174
}
21742175
print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
21752176
file_name=>$diff{'file'})},
@@ -2208,17 +2209,16 @@ sub git_difftree_body {
22082209
"diff") .
22092210
" | ";
22102211
}
2211-
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
2212-
hash_base=>$parent, file_name=>$diff{'from_file'})},
2213-
"blob") . " | ";
2212+
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
2213+
hash_base=>$parent, file_name=>$diff{'to_file'})},
2214+
"blob") . " | ";
22142215
if ($have_blame) {
2215-
print $cgi->a({-href => href(action=>"blame",
2216-
hash_base=>$hash,
2217-
file_name=>$diff{'to_file'})},
2218-
"blame") . " | ";
2216+
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
2217+
file_name=>$diff{'to_file'})},
2218+
"blame") . " | ";
22192219
}
2220-
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
2221-
file_name=>$diff{'from_file'})},
2220+
print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
2221+
file_name=>$diff{'to_file'})},
22222222
"history");
22232223
print "</td>\n";
22242224

0 commit comments

Comments
 (0)