summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorLibravatar Ammon Riley <ammon.riley@gmail.com>2012-08-30 15:53:57 -0700
committerLibravatar Eric Wong <normalperson@yhbt.net>2012-10-05 22:48:12 +0000
commit9478b11968d61085bb4c4343395b6f52ce06380f (patch)
treeb137728212e05436c4e2f4d3a45678f9e143d1f0 /perl
parentt9164: Add missing quotes in test (diff)
downloadtgif-9478b11968d61085bb4c4343395b6f52ce06380f.tar.xz
Make git-svn branch patterns match complete URL
When using the {word,[...]} style of configuration for tags and branches, it appears the intent is to only match whole path parts, since the words in the {} pattern are meta-character quoted. When the pattern word appears in the beginning or middle of the url, it's matched completely, since the left side, pattern, and (non-empty) right side are joined together with path separators. However, when the pattern word appears at the end of the URL, the right side is an empty pattern, and the resulting regex matches more than just the specified pattern. For example, if you specify something along the lines of branches = branches/project/{release_1,release_2} and your repository also contains "branches/project/release_1_2", you will also get the release_1_2 branch. By restricting the match regex with anchors, this is avoided. Signed-off-by: Ammon Riley <ammon.riley@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git/SVN/GlobSpec.pm4
1 files changed, 3 insertions, 1 deletions
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;