@matheusbsbs / matheus-bagliano / commits / 897d1d2e2a
Fork 0

gitweb: Finish restoring "blob" links in git_difftree_body

This finishes work started by commit 4777b0141a4812177390da4b6ebc9d40ac3da4b5 "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>

Jakub Narebski committed Nov 19, 2006 at 22:51 UTC 897d1d2e2a36d433c49d6246cd38133a540adddc
1 file changed +21 -21
gitweb/gitweb.perl
+21 -21
@@ -2092,7 +2092,11 @@ sub git_difftree_body {
2092 # link to patch
2093 $patchno++;
2094 print $cgi->a({-href => "#patch$patchno"}, "patch");
2095 + print " | ";
2096 }
2097 + print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
2098 + hash_base=>$hash, file_name=>$diff{'file'})},
2099 + "blob") . " | ";
2100 print "</td>\n";
2101
2102 } elsif ($diff{'status'} eq "D") { # deleted
@@ -2112,13 +2116,11 @@ sub git_difftree_body {
2116 }
2117 print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
2118 hash_base=>$parent, file_name=>$diff{'file'})},
2115 - "blob") . " | ";
2119 + "blob") . " | ";
2120 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") . " | ";
2124 }
2125 print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
2126 file_name=>$diff{'file'})},
@@ -2163,13 +2165,12 @@ sub git_difftree_body {
2165 " | ";
2166 }
2167 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") . " | ";
2170 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") . " | ";
2174 }
2175 print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
2176 file_name=>$diff{'file'})},
@@ -2208,17 +2209,16 @@ sub git_difftree_body {
2209 "diff") .
2210 " | ";
2211 }
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") . " | ";
2215 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") . " | ";
2219 }
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'})},
2222 "history");
2223 print "</td>\n";
2224