git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Eli Barzilay <eli@barzilay.org>
Subject: [PATCH 1/2] gitweb: Fix bug in evaluate_path_info
Date: Wed, 13 Oct 2010 13:33:48 +0200	[thread overview]
Message-ID: <20101013112738.9292.46672.stgit@localhost.localdomain> (raw)

There was bug in parsing "project/:/file" and "project/:/" path_info
URLs, with implicit HEAD as 'hash_base'.

For such URLs the refname is empty, and before this fix regexp for
parsing path_info fragment assumed that it is always non-empty.

Refname cannot contain ':', as per 'git check-ref-format'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This was detected by t9500-gitweb-standalone-no-errors test script,
but only after applying second patch in this series.

Unfortunately it is not easy to detect that gitweb generated correct
view; t9500 script only checks if Perl doesn't show any errors or
warnings.  That is why I have not added test for this issue (yet).

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 15b5bb9..9116a0e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -780,10 +780,10 @@ sub evaluate_path_info {
 		'history',
 	);
 
-	# we want to catch
+	# we want to catch, among others
 	# [$hash_parent_base[:$file_parent]..]$hash_parent[:$file_name]
 	my ($parentrefname, $parentpathname, $refname, $pathname) =
-		($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?(.+?)(?::(.+))?$/);
+		($path_info =~ /^(?:(.+?)(?::(.+))?\.\.)?([^:]+?)?(?::(.+))?$/);
 
 	# first, analyze the 'current' part
 	if (defined $pathname) {

             reply	other threads:[~2010-10-13 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-13 11:33 Jakub Narebski [this message]
2010-10-13 11:35 ` [PATCH 2/2] gitweb: Improve behavior for actionless path_info gitweb URLs Jakub Narebski

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20101013112738.9292.46672.stgit@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=eli@barzilay.org \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).