git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: tree view: hash_base and hash are now context sensitive
@ 2006-09-26 19:47 Luben Tuikov
  2006-09-26 20:34 ` Jakub Narebski
  0 siblings, 1 reply; 13+ messages in thread
From: Luben Tuikov @ 2006-09-26 19:47 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

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(-)

[-- Attachment #2: 1908141687-p2.txt --]
[-- Type: text/plain, Size: 1075 bytes --]

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH] gitweb: tree view: hash_base and hash are now context sensitive
@ 2006-09-29 16:57 Luben Tuikov
  0 siblings, 0 replies; 13+ messages in thread
From: Luben Tuikov @ 2006-09-29 16:57 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

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 |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

[-- Attachment #2: 1207600725-p1.txt --]
[-- Type: text/plain, Size: 1129 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index be336f6..44991b1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1672,9 +1672,9 @@ sub git_print_tree_entry {
 			              "history");
 		}
 		print " | " .
-		      $cgi->a({-href => href(action=>"blob_plain",
-		                             hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
-		              "raw");
+			$cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
+					       file_name=>"$basedir$t->{'name'}")},
+				"raw");
 		print "</td>\n";
 
 	} elsif ($t->{'type'} eq "tree") {
@@ -2745,14 +2745,14 @@ sub git_blob {
 sub git_tree {
 	my $have_snapshot = gitweb_have_snapshot();
 
+	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";

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-10-02 19:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26 19:47 [PATCH] gitweb: tree view: hash_base and hash are now context sensitive Luben Tuikov
2006-09-26 20:34 ` Jakub Narebski
2006-09-26 21:17   ` Luben Tuikov
2006-09-27  6:48     ` Junio C Hamano
2006-09-27 22:53       ` Luben Tuikov
2006-09-28 18:52         ` Luben Tuikov
2006-09-29  6:06           ` Junio C Hamano
2006-09-29 16:16             ` Luben Tuikov
2006-09-29 20:35               ` Jakub Narebski
2006-09-29 23:30                 ` Luben Tuikov
2006-10-01 22:27                   ` Jakub Narebski
2006-10-02 19:51                     ` Luben Tuikov
  -- strict thread matches above, loose matches on Subject: below --
2006-09-29 16:57 Luben Tuikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).