git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: tree view: hash_base and hash are now context sensitive

From
LTLuben Tuikov <ltuikov@yahoo.com>
Date
Sep 26, 2006, 19:47 UTC
Message-ID
<20060926194706.32255.qmail@web31804.mail.mud.yahoo.com>

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>
---
 gitweb/gitweb.perl |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8e9c827..56638f2 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1625,7 +1625,7 @@ sub git_print_tree_entry {
 			              "history");
 		}
 		print " | " .
-			$cgi->a({-href => href(action=>"blob_plain", hash_base=>"HEAD",
+			$cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
 					       file_name=>"$basedir$t->{'name'}")},
 				"raw");
 		print "</td>\n";
@@ -2713,14 +2713,14 @@ sub git_tree {
 	my ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');
 	my $have_snapshot = (defined $ctype && defined $suffix);
 
+	if (!defined $hash_base) {
+		$hash_base = "HEAD";
+	}
 	if (!defined $hash) {
-		$hash = git_get_head_hash($project);
 		if (defined $file_name) {
-			my $base = $hash_base || $hash;
-			$hash = git_get_hash_by_path($base, $file_name, "tree");
-		}
-		if (!defined $hash_base) {
-			$hash_base = $hash;
+			$hash = git_get_hash_by_path($hash_base, $file_name, "tree");
+		} else {
+			$hash = $hash_base;
 		}
 	}
 	$/ = "\0";
-- 
1.4.2.1.g893b0
Next: Jakub Narebski
Message 1 of 12 in “gitweb: tree view: hash_base and hash are now context sensitive”
  1. gitweb: tree view: hash_base and hash are now context sensitiveLuben Tuikov, Sep 26, 2006
  2. Jakub NarebskiSep 26, 2006
  3. Luben TuikovSep 26, 2006
  4. Junio C HamanoSep 27, 2006
  5. Luben TuikovSep 27, 2006
  6. Luben TuikovSep 28, 2006
  7. Junio C HamanoSep 29, 2006
  8. Luben TuikovSep 29, 2006
  9. Jakub NarebskiSep 29, 2006
  10. Luben TuikovSep 29, 2006
  11. Jakub NarebskiOct 1, 2006
  12. Luben TuikovOct 2, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.