summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorVictor Leschuk <vleschuk@gmail.com>2016-01-11 17:25:58 +0300
committerEric Wong <normalperson@yhbt.net>2016-03-15 01:35:38 +0000
commite4e5dd94e6eea4b50d8baed8b6b8cc50f6c8eae4 (patch)
tree5d812499bc6dd8d2c281e4ca20a35eee4a05b822 /perl
parentdb6696f653b917509dac1ac13b922e12773a84ff (diff)
downloadgit-e4e5dd94e6eea4b50d8baed8b6b8cc50f6c8eae4.tar.gz
git-svn: loosen config globs limitations
Expand the area of globs applicability for branches and tags in git-svn. It is now possible to use globs like 'a*e', or 'release_*'. This allows users to avoid long lines in config like: branches = branches/{release_20,release_21,release_22,...} In favor of: branches = branches/release_* [ew: amended commit message, minor formatting and style fixes] Signed-off-by: Victor Leschuk <vleschuk@accesssoftek.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git/SVN/GlobSpec.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/perl/Git/SVN/GlobSpec.pm b/perl/Git/SVN/GlobSpec.pm
index c95f5d76ca..4775026c5d 100644
--- a/perl/Git/SVN/GlobSpec.pm
+++ b/perl/Git/SVN/GlobSpec.pm
@@ -11,16 +11,20 @@ sub new {
my $die_msg = "Only one set of wildcard directories " .
"(e.g. '*' or '*/*/*') is supported: '$glob'\n";
for my $part (split(m|/|, $glob)) {
- if ($part =~ /\*/ && $part ne "*") {
- die "Invalid pattern in '$glob': $part\n";
- } elsif ($pattern_ok && $part =~ /[{}]/ &&
+ if ($pattern_ok && $part =~ /[{}]/ &&
$part !~ /^\{[^{}]+\}/) {
die "Invalid pattern in '$glob': $part\n";
}
- if ($part eq "*") {
+ my $nstars = $part =~ tr/*//;
+ if ($nstars > 1) {
+ die "Only one '*' is allowed in a pattern: '$part'\n";
+ }
+ if ($part =~ /(.*)\*(.*)/) {
die $die_msg if $state eq "right";
+ my ($l, $r) = ($1, $2);
$state = "pattern";
- push(@patterns, "[^/]*");
+ my $pat = quotemeta($l) . '[^/]*' . quotemeta($r);
+ push(@patterns, $pat);
} elsif ($pattern_ok && $part =~ /^\{(.*)\}$/) {
die $die_msg if $state eq "right";
$state = "pattern";