gitweb.cgi: Teach git_history() to read hash from $hash_base
Teach git_history() to take its hash argument from the hb parameter, i.e. from $hash_base. Also change all "a=history" actions to pass "hb=" instead of "h=". Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Luben Tuikov committed
Jul 23, 2006 at 13:26 UTC
c6e1d9ed509265a66fe9d155b1a66aa954cce675
1 file changed
+13
-13
gitweb/gitweb.cgi
+13
-13
@@ -1687,7 +1687,7 @@ sub git_tree {
1687
"<td class=\"link\">" .
1688
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
1689
# " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
1690
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
1690
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") .
1691
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") .
1692
"</td>\n";
1693
} elsif ($t_type eq "tree") {
@@ -1696,7 +1696,7 @@ sub git_tree {
1696
"</td>\n" .
1697
"<td class=\"link\">" .
1698
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name")}, "tree") .
1699
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
1699
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") .
1700
"</td>\n";
1701
}
1702
print "</tr>\n";
@@ -2041,7 +2041,7 @@ sub git_commit {
2041
"<td><span class=\"file_status deleted\">[deleted " . file_type($from_mode). "]</span></td>\n" .
2042
"<td class=\"link\">" .
2043
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
2044
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") .
2044
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") .
2045
"</td>\n"
2046
} elsif ($status eq "M" || $status eq "T") {
2047
my $mode_chnge = "";
@@ -2072,7 +2072,7 @@ sub git_commit {
2072
if ($to_id ne $from_id) {
2073
print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff");
2074
}
2075
- print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") . "\n";
2075
+ print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") . "\n";
2076
print "</td>\n";
2077
} elsif ($status eq "R") {
2078
my ($from_file, $to_file) = split "\t", $file;
@@ -2293,10 +2293,10 @@ sub git_commitdiff_plain {
2293
}
2294
2295
sub git_history {
2296
- if (!defined $hash) {
2297
- $hash = git_read_head($project);
2296
+ if (!defined $hash_base) {
2297
+ $hash_base = git_read_head($project);
2298
}
2299
- my %co = git_read_commit($hash);
2299
+ my %co = git_read_commit($hash_base);
2300
if (!%co) {
2301
die_error(undef, "Unknown commit object.");
2302
}
@@ -2306,18 +2306,18 @@ sub git_history {
2306
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
2307
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
2308
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
2309
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
2310
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
2311
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
2309
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
2310
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
2311
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
2312
"<br/><br/>\n" .
2313
"</div>\n";
2314
print "<div>\n" .
2315
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2315
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
2316
"</div>\n";
2317
print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
2318
2319
open my $fd, "-|",
2320
- "$GIT rev-list --full-history $hash -- \'$file_name\'";
2320
+ "$GIT rev-list --full-history $hash_base -- \'$file_name\'";
2321
print "<table cellspacing=\"0\">\n";
2322
my $alternate = 0;
2323
while (my $line = <$fd>) {
@@ -2345,7 +2345,7 @@ sub git_history {
2345
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
2346
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2347
" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
2348
- my $blob = git_get_hash_by_path($hash, $file_name);
2348
+ my $blob = git_get_hash_by_path($hash_base, $file_name);
2349
my $blob_parent = git_get_hash_by_path($commit, $file_name);
2350
if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
2351
print " | " .