diff --git a/perl/Git/SVN/GlobSpec.pm b/perl/Git/SVN/GlobSpec.pm index 96cfd9896e..c95f5d76ca 100644 --- a/perl/Git/SVN/GlobSpec.pm +++ b/perl/Git/SVN/GlobSpec.pm @@ -44,7 +44,9 @@ sub new { my $right = join('/', @right); $re = join('/', @patterns); $re = join('\/', - grep(length, quotemeta($left), "($re)", quotemeta($right))); + 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; diff --git a/t/t9154-git-svn-fancy-glob.sh b/t/t9154-git-svn-fancy-glob.sh index a6a56a6cb9..b780e0efe3 100755 --- a/t/t9154-git-svn-fancy-glob.sh +++ b/t/t9154-git-svn-fancy-glob.sh @@ -21,6 +21,15 @@ test_expect_success 'add red branch' " test_must_fail git rev-parse refs/remotes/blue " +test_expect_success 'add gre branch' " + GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev && + git config svn-remote.svn.branches 'branches/{red,gre}:refs/remotes/*' && + git svn fetch && + git rev-parse refs/remotes/red && + test_must_fail git rev-parse refs/remotes/green && + test_must_fail git rev-parse refs/remotes/blue + " + test_expect_success 'add green branch' " GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev && git config svn-remote.svn.branches 'branches/{red,green}:refs/remotes/*' &&