Introduce prefixed globs for branches and tags in git-svn. Signed-off-by: Victor Leschuk <vleschuk@xxxxxxxxxxxxxxxx> --- Documentation/git-svn.txt | 5 +++++ perl/Git/SVN/GlobSpec.pm | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 0c0f60b..529cffe 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -1034,6 +1034,7 @@ listed below are allowed: url = http://server.org/svn fetch = trunk/project-a:refs/remotes/project-a/trunk branches = branches/*/project-a:refs/remotes/project-a/branches/* + branches = branches/release_*:refs/remotes/project-a/branches/release_* tags = tags/*/project-a:refs/remotes/project-a/tags/* ------------------------------------------------------------------------ @@ -1044,6 +1045,10 @@ independent path component (surrounded by '/' or EOL). This type of configuration is not automatically created by 'init' and should be manually entered with a text-editor or using 'git config'. +Also note that prefixed globs (e.g. 'release_*') match everything after prefix +but do not match exact prefix. For example: +'release_*' will match 'release_1' or 'release_v1' but will not match 'release_'. + It is also possible to fetch a subset of branches or tags by using a comma-separated list of names within braces. For example: diff --git a/perl/Git/SVN/GlobSpec.pm b/perl/Git/SVN/GlobSpec.pm index c95f5d7..a136090 100644 --- a/perl/Git/SVN/GlobSpec.pm +++ b/perl/Git/SVN/GlobSpec.pm @@ -11,16 +11,15 @@ 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 "*") { + if ($part =~ /(\w*)\*/) { die $die_msg if $state eq "right"; $state = "pattern"; - push(@patterns, "[^/]*"); + my $pat = $1 ? "${1}[^/]+" : "[^/]*"; + push(@patterns, $pat); } elsif ($pattern_ok && $part =~ /^\{(.*)\}$/) { die $die_msg if $state eq "right"; $state = "pattern"; -- 2.7.0.rc0.21.gb793f61 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html