All of lore.kernel.org
 help / color / mirror / Atom feed
From: jk@blackdown.de (Jürgen Kreileder)
To: git@vger.kernel.org
Subject: [PATCH 4/4] gitweb: Fix broken blob action parameters on blob/commitdiff pages
Date: Mon, 08 Apr 2013 22:10:21 +0200	[thread overview]
Message-ID: <m2vc7wbx76.fsf@blackdown.de> (raw)

Fix broken blob action parameters on blobdiff and commitdiff pages by
explicitly passing variables instead of relying on global ones.

(The broken parameters on blob links lead to blob pages which show the
blob but with a hash instead of a commit message and have broken
blob_plain (404 - Cannot find file) and tree links (404 - Reading tree
failed))

Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
---
 gitweb/gitweb.perl |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1309196..995e8fb 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2258,7 +2258,7 @@ sub format_extended_diff_header_line {
 
 # format from-file/to-file diff header
 sub format_diff_from_to_header {
-	my ($from_line, $to_line, $diffinfo, $from, $to, @parents) = @_;
+	my ($from_line, $to_line, $diffinfo, $from, $to, $hash, @parents) = @_;
 	my $line;
 	my $result = '';
 
@@ -2324,7 +2324,7 @@ sub format_diff_from_to_header {
 
 # create note for patch simplified by combined diff
 sub format_diff_cc_simplified {
-	my ($diffinfo, @parents) = @_;
+	my ($diffinfo, $hash, @parents) = @_;
 	my $result = '';
 
 	$result .= "<div class=\"diff header\">" .
@@ -3592,7 +3592,8 @@ sub parse_ls_tree_line {
 
 # generates _two_ hashes, references to which are passed as 2 and 3 argument
 sub parse_from_to_diffinfo {
-	my ($diffinfo, $from, $to, @parents) = @_;
+	my ($diffinfo, $from, $to, $hash, @parents) = @_;
+	my ($hash_parent) = $parents[0];
 
 	if ($diffinfo->{'nparents'}) {
 		# combined diff
@@ -5312,7 +5313,7 @@ sub git_patchset_body {
 			if ($is_combined) {
 				while ($to_name ne $diffinfo->{'to_file'}) {
 					print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
-					      format_diff_cc_simplified($diffinfo, @hash_parents) .
+					      format_diff_cc_simplified($diffinfo, $hash, @hash_parents) .
 					      "</div>\n";  # class="patch"
 
 					$patch_idx++;
@@ -5324,7 +5325,7 @@ sub git_patchset_body {
 			}
 
 			# modifies %from, %to hashes
-			parse_from_to_diffinfo($diffinfo, \%from, \%to, @hash_parents);
+			parse_from_to_diffinfo($diffinfo, \%from, \%to, $hash, @hash_parents);
 
 			# this is first patch for raw difftree line with $patch_idx index
 			# we index @$difftree array from 0, but number patches from 1
@@ -5367,7 +5368,7 @@ sub git_patchset_body {
 
 		print format_diff_from_to_header($last_patch_line, $patch_line,
 		                                 $diffinfo, \%from, \%to,
-		                                 @hash_parents);
+		                                 $hash, @hash_parents);
 
 		# the patch itself
 	LINE:
@@ -5404,7 +5405,7 @@ sub git_patchset_body {
 
 		# generate anchor for "patch" links in difftree / whatchanged part
 		print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
-		      format_diff_cc_simplified($diffinfo, @hash_parents) .
+		      format_diff_cc_simplified($diffinfo, $hash, @hash_parents) .
 		      "</div>\n";  # class="patch"
 
 		$patch_number++;
-- 
1.7.10.4

             reply	other threads:[~2013-04-08 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 20:10 Jürgen Kreileder [this message]
2013-04-09 15:25 ` [PATCH 4/4] gitweb: Fix broken blob action parameters on blob/commitdiff pages Jakub Narębski
2013-04-09 20:17   ` Jürgen Kreileder

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=m2vc7wbx76.fsf@blackdown.de \
    --to=jk@blackdown.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.