Git development
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov@yahoo.com>
To: git@vger.kernel.org
Subject: [PATCH] gitweb: bugfix: git_print_page_path() needs the hash base
Date: Thu, 17 Aug 2006 10:39:29 -0700 (PDT)	[thread overview]
Message-ID: <20060817173929.46560.qmail@web31813.mail.mud.yahoo.com> (raw)

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

If a file F exists in branch B, but doesn't exist
in master branch, then blob_plain needs the hash base in
order to properly get the file.  The hash base is passed
on symbolically so we still preserve the "latest" quality
of the link presented by git_print_page_path().

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

[-- Attachment #2: 2795696785-p1.patch --]
[-- Type: application/octet-stream, Size: 3264 bytes --]

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 36d3082..bb77b55 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1175,12 +1175,18 @@ sub git_print_header_div {
 sub git_print_page_path {
 	my $name = shift;
 	my $type = shift;
+	my $hb = shift;
 
 	if (!defined $name) {
 		print "<div class=\"page_path\"><b>/</b></div>\n";
 	} elsif (defined $type && $type eq 'blob') {
-		print "<div class=\"page_path\"><b>" .
-			$cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)}, esc_html($name)) . "</b><br/></div>\n";
+		print "<div class=\"page_path\"><b>";
+		if (defined $hb) {
+			print $cgi->a({-href => href(action=>"blob_plain", hash_base=>$hb, file_name=>$file_name)}, esc_html($name));
+		} else {
+			print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)}, esc_html($name));
+		}
+		print "</b><br/></div>\n";
 	} else {
 		print "<div class=\"page_path\"><b>" . esc_html($name) . "</b><br/></div>\n";
 	}
@@ -1868,7 +1874,7 @@ sub git_blame2 {
 		" | " . $cgi->a({-href => href(action=>"blame", file_name=>$file_name)}, "head");
 	git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
 	git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
-	git_print_page_path($file_name, $ftype);
+	git_print_page_path($file_name, $ftype, $hash_base);
 	my @rev_color = (qw(light2 dark2));
 	my $num_colors = scalar(@rev_color);
 	my $current_color = 0;
@@ -1922,7 +1928,7 @@ sub git_blame {
 		" | " . $cgi->a({-href => href(action=>"blame", file_name=>$file_name)}, "head");
 	git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
 	git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
-	git_print_page_path($file_name, 'blob');
+	git_print_page_path($file_name, 'blob', $hash_base);
 	print "<div class=\"page_body\">\n";
 	print <<HTML;
 <table class="blame">
@@ -2085,7 +2091,7 @@ sub git_blob {
 		      "<br/><br/></div>\n" .
 		      "<div class=\"title\">$hash</div>\n";
 	}
-	git_print_page_path($file_name, "blob");
+	git_print_page_path($file_name, "blob", $hash_base);
 	print "<div class=\"page_body\">\n";
 	my $nr;
 	while (my $line = <$fd>) {
@@ -2135,7 +2141,7 @@ sub git_tree {
 	if (defined $file_name) {
 		$base = esc_html("$file_name/");
 	}
-	git_print_page_path($file_name, 'tree');
+	git_print_page_path($file_name, 'tree', $hash_base);
 	print "<div class=\"page_body\">\n";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
@@ -2332,7 +2338,7 @@ sub git_blobdiff {
 		      "<br/><br/></div>\n" .
 		      "<div class=\"title\">$hash vs $hash_parent</div>\n";
 	}
-	git_print_page_path($file_name, "blob");
+	git_print_page_path($file_name, "blob", $hash_base);
 	print "<div class=\"page_body\">\n" .
 	      "<div class=\"diff_info\">blob:" .
 	      $cgi->a({-href => href(action=>"blob", hash=>$hash_parent, hash_base=>$hash_base, file_name=>($file_parent || $file_name))}, $hash_parent) .
@@ -2502,7 +2508,7 @@ sub git_history {
 	if (defined $hash) {
 		$ftype = git_get_type($hash);
 	}
-	git_print_page_path($file_name, $ftype);
+	git_print_page_path($file_name, $ftype, $hash_base);
 
 	open my $fd, "-|",
 		$GIT, "rev-list", "--full-history", $hash_base, "--", $file_name;
-- 
1.4.2.gdb98


                 reply	other threads:[~2006-08-17 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060817173929.46560.qmail@web31813.mail.mud.yahoo.com \
    --to=ltuikov@yahoo.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox