Skip to content

Commit eaa14ff

Browse files
author
Eric Wong
committed
git svn: the branch command no longer needs the full path
This was introduced in 0b2af45 ("Fix branch detection when repository root is inaccessible") but reintroduced in the previous commit. Signed-off-by: Eric Wong <[email protected]>
1 parent 6b48829 commit eaa14ff

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

git-svn.perl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,22 @@ sub cmd_branch {
666666
}
667667
}
668668
unless (defined $glob) {
669-
die "Unknown ",
670-
$_tag ? "tag" : "branch",
671-
" destination $_branch_dest\n";
669+
my $dest_re = qr/\b\Q$_branch_dest\E\b/;
670+
foreach my $g (@{$allglobs}) {
671+
$g->{path}->{left} =~ /$dest_re/ or next;
672+
if (defined $glob) {
673+
die "Ambiguous destination: ",
674+
$_branch_dest, "\nmatches both '",
675+
$glob->{path}->{left}, "' and '",
676+
$g->{path}->{left}, "'\n";
677+
}
678+
$glob = $g;
679+
}
680+
unless (defined $glob) {
681+
die "Unknown ",
682+
$_tag ? "tag" : "branch",
683+
" destination $_branch_dest\n";
684+
}
672685
}
673686
}
674687
my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};

t/t9141-git-svn-multiple-branches.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ test_expect_success 'Multiple branch or tag paths require -d' '
9999

100100
test_expect_success 'create new branches and tags' '
101101
( cd git_project &&
102-
git svn branch -m "New branch 1" -d project/b_one New1 ) &&
102+
git svn branch -m "New branch 1" -d b_one New1 ) &&
103103
( cd svn_project &&
104104
svn_cmd up && test -e b_one/New1/a.file ) &&
105105
106106
( cd git_project &&
107-
git svn branch -m "New branch 2" -d project/b_two New2 ) &&
107+
git svn branch -m "New branch 2" -d b_two New2 ) &&
108108
( cd svn_project &&
109109
svn_cmd up && test -e b_two/New2/a.file ) &&
110110
111111
( cd git_project &&
112-
git svn branch -t -m "New tag 1" -d project/tags_A Tag1 ) &&
112+
git svn branch -t -m "New tag 1" -d tags_A Tag1 ) &&
113113
( cd svn_project &&
114114
svn_cmd up && test -e tags_A/Tag1/a.file ) &&
115115
116116
( cd git_project &&
117-
git svn tag -m "New tag 2" -d project/tags_B Tag2 ) &&
117+
git svn tag -m "New tag 2" -d tags_B Tag2 ) &&
118118
( cd svn_project &&
119119
svn_cmd up && test -e tags_B/Tag2/a.file )
120120
'

0 commit comments

Comments
 (0)