Subject: [PATCH 1/2] gitweb: Show snapshot links for tree entries in tree listing

From: Petr Baudis <[email-masked]>
Date: Sat, 07 Oct 2006 16:10:41 +0200

Currently that's inconsistently reachable only by first displaying the
tree.

Signed-off-by: Petr Baudis <[email-masked]>
---

 gitweb/gitweb.perl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c4970f4..096a01b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1752,7 +1752,7 @@ sub git_print_simplified_log {
 
 # print tree entry (row of git_tree), but without encompassing <tr> element
 sub git_print_tree_entry {
-	my ($t, $basedir, $hash_base, $have_blame) = @_;
+	my ($t, $basedir, $hash_base, $have_blame, $have_snapshot) = @_;
 
 	my %base_key = ();
 	$base_key{hash_base} = $hash_base if defined $hash_base;
@@ -1798,6 +1798,13 @@ sub git_print_tree_entry {
 			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             file_name=>"$basedir$t->{'name'}")},
 			              "history");
+			if ($have_snapshot) {
+				print " | ";
+			}
+		}
+		if ($have_snapshot) {
+			print $cgi->a({-href => href(action=>"snapshot", hash=>$t->{'hash'})},
+				      "snapshot");
 		}
 		print "</td>\n";
 	}
@@ -2931,7 +2938,7 @@ sub git_tree {
 		}
 		$alternate ^= 1;
 
-		git_print_tree_entry(\%t, $base, $hash_base, $have_blame);
+		git_print_tree_entry(\%t, $base, $hash_base, $have_blame, $have_snapshot);
 
 		print "</tr>\n";
 	}