[PATCH] git-svn.perl: Fix glob matching on svn paths
* 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