From c6e1d9ed509265a66fe9d155b1a66aa954cce675 Mon Sep 17 00:00:00 2001 From: Luben Tuikov Date: Sun, 23 Jul 2006 13:26:30 -0700 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- gitweb/gitweb.cgi | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi index 2fd1e5f78..d976d4adc 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.cgi @@ -1687,7 +1687,7 @@ sub git_tree { "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") . # " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") . "\n"; } elsif ($t_type eq "tree") { @@ -1696,7 +1696,7 @@ sub git_tree { "\n" . "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name")}, "tree") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") . "\n"; } print "\n"; @@ -2041,7 +2041,7 @@ sub git_commit { "[deleted " . file_type($from_mode). "]\n" . "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") . "\n" } elsif ($status eq "M" || $status eq "T") { my $mode_chnge = ""; @@ -2072,7 +2072,7 @@ sub git_commit { if ($to_id ne $from_id) { print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff"); } - print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") . "\n"; + print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") . "\n"; print "\n"; } elsif ($status eq "R") { my ($from_file, $to_file) = split "\t", $file; @@ -2293,10 +2293,10 @@ sub git_commitdiff_plain { } sub git_history { - if (!defined $hash) { - $hash = git_read_head($project); + if (!defined $hash_base) { + $hash_base = git_read_head($project); } - my %co = git_read_commit($hash); + my %co = git_read_commit($hash_base); if (!%co) { die_error(undef, "Unknown commit object."); } @@ -2306,18 +2306,18 @@ sub git_history { $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") . + " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "

\n" . "\n"; print "
\n" . - $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" . "
\n"; print "
/" . esc_html($file_name) . "
\n"; open my $fd, "-|", - "$GIT rev-list --full-history $hash -- \'$file_name\'"; + "$GIT rev-list --full-history $hash_base -- \'$file_name\'"; print "\n"; my $alternate = 0; while (my $line = <$fd>) { @@ -2345,7 +2345,7 @@ sub git_history { $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=$commit;f=$file_name")}, "blob"); - my $blob = git_get_hash_by_path($hash, $file_name); + my $blob = git_get_hash_by_path($hash_base, $file_name); my $blob_parent = git_get_hash_by_path($commit, $file_name); if (defined $blob && defined $blob_parent && $blob ne $blob_parent) { print " | " . -- 2.30.2