gitweb: bugfix: git_commit and git_commitdiff parents
In git_commit() the hash base of $from_id is $parent, not $hash: - If status is "D", then action blob for $from_id wants $parent, not $hash. History needs $parent too. - If status is "R", then action blob for $from_id wants $parent, not $hash. Similarly in git_commitdiff() the hash base of $from_id is $hash_parent, not $hash. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Luben Tuikov committed
Aug 4, 2006 at 15:11 UTC
d636ad9743783c728469a9b644c23c0415fe1a7b
1 file changed
+9
-7
gitweb/gitweb.perl
+9
-7
@@ -2015,11 +2015,11 @@ sub git_commit {
2015
"<td class=\"link\">" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, "blob") . "</td>\n";
2016
} elsif ($status eq "D") {
2017
print "<td>" .
2018
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file"), -class => "list"}, esc_html($file)) . "</td>\n" .
2018
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$parent;f=$file"), -class => "list"}, esc_html($file)) . "</td>\n" .
2019
"<td><span class=\"file_status deleted\">[deleted " . file_type($from_mode). "]</span></td>\n" .
2020
"<td class=\"link\">" .
2021
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
2022
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") .
2021
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$parent;f=$file")}, "blob") .
2022
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$parent;f=$file")}, "history") .
2023
"</td>\n"
2024
} elsif ($status eq "M" || $status eq "T") {
2025
my $mode_chnge = "";
@@ -2061,7 +2061,7 @@ sub git_commit {
2061
print "<td>" .
2062
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file"), -class => "list"}, esc_html($to_file)) . "</td>\n" .
2063
"<td><span class=\"file_status moved\">[moved from " .
2064
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file"), -class => "list"}, esc_html($from_file)) .
2064
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$parent;f=$from_file"), -class => "list"}, esc_html($from_file)) .
2065
" with " . (int $similarity) . "% similarity$mode_chng]</span></td>\n" .
2066
"<td class=\"link\">" .
2067
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file")}, "blob");
@@ -2177,15 +2177,17 @@ sub git_commitdiff {
2177
git_diff_print(undef, "/dev/null", $to_id, "b/$file");
2178
} elsif ($status eq "D") {
2179
print "<div class=\"diff_info\">" . file_type($from_mode) . ":" .
2180
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) . "(deleted)" .
2180
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash_parent;f=$file")}, $from_id) . "(deleted)" .
2181
"</div>\n";
2182
git_diff_print($from_id, "a/$file", undef, "/dev/null");
2183
} elsif ($status eq "M") {
2184
if ($from_id ne $to_id) {
2185
print "<div class=\"diff_info\">" .
2186
- file_type($from_mode) . ":" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, $from_id) .
2186
+ file_type($from_mode) . ":" .
2187
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash_parent;f=$file")}, $from_id) .
2188
" -> " .
2188
- file_type($to_mode) . ":" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id);
2189
+ file_type($to_mode) . ":" .
2190
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$to_id;hb=$hash;f=$file")}, $to_id);
2191
print "</div>\n";
2192
git_diff_print($from_id, "a/$file", $to_id, "b/$file");
2193
}