git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tomáš Ebenlendr" <ebik@ucw.cz>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org, "Tomáš Ebenlendr" <ebik@ucw.cz>
Subject: [PATCH] git-svn.perl: Fix glob matching on svn paths
Date: Sat,  9 Oct 2010 11:07:16 +0200	[thread overview]
Message-ID: <1286615236-29732-2-git-send-email-ebik@ucw.cz> (raw)
In-Reply-To: <1286615236-29732-1-git-send-email-ebik@ucw.cz>

* Git::SVN::GlobSPec::new():
  - Directories or files with empty name are not allowed: The star pattern
    has to match at least one character.
  - The main pattern has to start with full path, i.e. "^/" is prepended.
    Also it has to end with directory boundary, i.e. "(/|$)" is appended.
---
 git-svn.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 18cfb24..01ae6a1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -6132,7 +6132,7 @@ sub new {
 		if ($part eq "*") {
 			die $die_msg if $state eq "right";
 			$state = "pattern";
-			push(@patterns, "[^/]*");
+			push(@patterns, "[^/]+");
 		} elsif ($pattern_ok && $part =~ /^\{(.*)\}$/) {
 			die $die_msg if $state eq "right";
 			$state = "pattern";
@@ -6155,8 +6155,8 @@ sub new {
 	my $left = join('/', @left);
 	my $right = join('/', @right);
 	$re = join('/', @patterns);
-	$re = join('\/',
-		   grep(length, quotemeta($left), "($re)", quotemeta($right)));
+	$re = '^\/'.join('\/',
+		   grep(length, quotemeta($left), "($re)", quotemeta($right))).'(?:\/|$)';
 	my $left_re = qr/^\/\Q$left\E(\/|$)/;
 	bless { left => $left, right => $right, left_regex => $left_re,
 	        regex => qr/$re/, glob => $glob, depth => $depth }, $class;
-- 
1.7.1

  reply	other threads:[~2010-10-09  9:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09  9:07 git-svn.perl: Fix glob matching on svn paths Tomáš Ebenlendr
2010-10-09  9:07 ` Tomáš Ebenlendr [this message]
2010-10-10  6:15   ` [PATCH] " Jonathan Nieder
2010-10-14  9:34     ` ebik

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=1286615236-29732-2-git-send-email-ebik@ucw.cz \
    --to=ebik@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /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;
as well as URLs for NNTP newsgroup(s).