Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-25 12:36:06 +0400
committerEric Wong <normalperson@yhbt.net>2009-07-25 15:09:43 +0400
commiteaa14ff8c7dbe51dfdfe7e2d9ede839fc62dcf52 (patch)
tree8ccc9e3285676850366262a41620f08d6b339674
parent6b48829dbbe06798eded1e7c5f70810940591f79 (diff)
git svn: the branch command no longer needs the full path
This was introduced in 0b2af457a49e3b00d47d556d5301934d27909db8 ("Fix branch detection when repository root is inaccessible") but reintroduced in the previous commit. Signed-off-by: Eric Wong <normalperson@yhbt.net>
-rwxr-xr-xgit-svn.perl19
-rwxr-xr-xt/t9141-git-svn-multiple-branches.sh8
2 files changed, 20 insertions, 7 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 10b77ad34c..9808597a18 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -666,9 +666,22 @@ sub cmd_branch {
}
}
unless (defined $glob) {
- die "Unknown ",
- $_tag ? "tag" : "branch",
- " destination $_branch_dest\n";
+ my $dest_re = qr/\b\Q$_branch_dest\E\b/;
+ foreach my $g (@{$allglobs}) {
+ $g->{path}->{left} =~ /$dest_re/ or next;
+ if (defined $glob) {
+ die "Ambiguous destination: ",
+ $_branch_dest, "\nmatches both '",
+ $glob->{path}->{left}, "' and '",
+ $g->{path}->{left}, "'\n";
+ }
+ $glob = $g;
+ }
+ unless (defined $glob) {
+ die "Unknown ",
+ $_tag ? "tag" : "branch",
+ " destination $_branch_dest\n";
+ }
}
}
my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
diff --git a/t/t9141-git-svn-multiple-branches.sh b/t/t9141-git-svn-multiple-branches.sh
index cb9a6d229d..3cd06718eb 100755
--- a/t/t9141-git-svn-multiple-branches.sh
+++ b/t/t9141-git-svn-multiple-branches.sh
@@ -99,22 +99,22 @@ test_expect_success 'Multiple branch or tag paths require -d' '
test_expect_success 'create new branches and tags' '
( cd git_project &&
- git svn branch -m "New branch 1" -d project/b_one New1 ) &&
+ git svn branch -m "New branch 1" -d b_one New1 ) &&
( cd svn_project &&
svn_cmd up && test -e b_one/New1/a.file ) &&
( cd git_project &&
- git svn branch -m "New branch 2" -d project/b_two New2 ) &&
+ git svn branch -m "New branch 2" -d b_two New2 ) &&
( cd svn_project &&
svn_cmd up && test -e b_two/New2/a.file ) &&
( cd git_project &&
- git svn branch -t -m "New tag 1" -d project/tags_A Tag1 ) &&
+ git svn branch -t -m "New tag 1" -d tags_A Tag1 ) &&
( cd svn_project &&
svn_cmd up && test -e tags_A/Tag1/a.file ) &&
( cd git_project &&
- git svn tag -m "New tag 2" -d project/tags_B Tag2 ) &&
+ git svn tag -m "New tag 2" -d tags_B Tag2 ) &&
( cd svn_project &&
svn_cmd up && test -e tags_B/Tag2/a.file )
'