From: Ammon Riley <ammon.riley@gmail.com>
To: git@vger.kernel.org
Cc: normalperson@yhbt.net, marcin@owsiany.pl, schwern@pobox.com,
Ammon Riley <ammon.riley@gmail.com>
Subject: [PATCH] Allow fancy globs in git-svn init branches
Date: Mon, 17 Sep 2012 16:46:38 -0700 [thread overview]
Message-ID: <1347925598-23907-1-git-send-email-ammon.riley@gmail.com> (raw)
Branches passed to 'git-svn init' via the -b/--branches flag
automatically had a /* appended to them. When the branch contained
a fancy glob with a {} pattern, this is incorrect behaviour, and
leads to odd branches being created in the git repository.
Signed-off-by: Ammon Riley <ammon.riley@gmail.com>
---
git-svn.perl | 2 +-
t/t9141-git-svn-multiple-branches.sh | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/git-svn.perl b/git-svn.perl
index 0d77ffb..f8e8558 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1678,7 +1678,7 @@ sub complete_url_ls_init {
my $remote_path = join_paths( $gs->path, $repo_path );
$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;
$remote_path =~ s#^/##g;
- $remote_path .= "/*" if $remote_path !~ /\*/;
+ $remote_path .= "/*" if $remote_path !~ m#\*|\{[^/]+\}#;
my ($n) = ($switch =~ /^--(\w+)/);
if (length $pfx && $pfx !~ m#/$#) {
die "--prefix='$pfx' must have a trailing slash '/'\n";
diff --git a/t/t9141-git-svn-multiple-branches.sh b/t/t9141-git-svn-multiple-branches.sh
index 3cd0671..1b872a9 100755
--- a/t/t9141-git-svn-multiple-branches.sh
+++ b/t/t9141-git-svn-multiple-branches.sh
@@ -119,4 +119,16 @@ test_expect_success 'create new branches and tags' '
svn_cmd up && test -e tags_B/Tag2/a.file )
'
+test_expect_success 'clone multiple branch paths using fancy glob' '
+ git svn clone -T trunk \
+ -b b_one/{first} --branches b_two \
+ "$svnrepo/project" git_project2 &&
+ ( cd git_project2 &&
+ git rev-parse refs/remotes/first &&
+ test_must_fail git rev-parse refs/remotes/second &&
+ git rev-parse refs/remotes/1 &&
+ git rev-parse refs/remotes/2
+ )
+'
+
test_done
--
1.7.12.465.gb319926
next reply other threads:[~2012-09-17 23:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 23:46 Ammon Riley [this message]
2012-09-18 20:46 ` [PATCH] Allow fancy globs in git-svn init branches Eric Wong
2012-09-18 22:56 ` Ammon Riley
2012-09-19 1:52 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347925598-23907-1-git-send-email-ammon.riley@gmail.com \
--to=ammon.riley@gmail.com \
--cc=git@vger.kernel.org \
--cc=marcin@owsiany.pl \
--cc=normalperson@yhbt.net \
--cc=schwern@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).