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>
This commit is contained in:

committed by
Eric Wong

parent
db6696f653
commit
e4e5dd94e6
@ -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";
|
||||
|
Reference in New Issue
Block a user