gitweb: tree view: hash_base and hash are now context sensitive
In tree view, by default, hash_base is HEAD and hash is the entry equivalent. Else the user had selected a hash_base or hash, say by clicking on a revision or commit, in which case those values are used. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Luben Tuikov committed
Sep 29, 2006 at 09:57 UTC
6f7ea5fb333554887656f7f6ec683544ec6e3c22
1 file changed
+9
-9
gitweb/gitweb.perl
+9
-9
@@ -1672,9 +1672,9 @@ sub git_print_tree_entry {
1672
"history");
1673
}
1674
print " | " .
1675
- $cgi->a({-href => href(action=>"blob_plain",
1676
- hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
1677
- "raw");
1675
+ $cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
1676
+ file_name=>"$basedir$t->{'name'}")},
1677
+ "raw");
1678
print "</td>\n";
1679
1680
} elsif ($t->{'type'} eq "tree") {
@@ -2745,14 +2745,14 @@ sub git_blob {
2745
sub git_tree {
2746
my $have_snapshot = gitweb_have_snapshot();
2747
2748
+ if (!defined $hash_base) {
2749
+ $hash_base = "HEAD";
2750
+ }
2751
if (!defined $hash) {
2749
- $hash = git_get_head_hash($project);
2752
if (defined $file_name) {
2751
- my $base = $hash_base || $hash;
2752
- $hash = git_get_hash_by_path($base, $file_name, "tree");
2753
- }
2754
- if (!defined $hash_base) {
2755
- $hash_base = $hash;
2753
+ $hash = git_get_hash_by_path($hash_base, $file_name, "tree");
2754
+ } else {
2755
+ $hash = $hash_base;
2756
}
2757
}
2758
$/ = "\0";