[PATCH] git-svn.perl: Fix glob matching on svn paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]