git svn: the branch command no longer needs the full path
This was introduced in 0b2af457a4
("Fix branch detection when repository root is inaccessible")
but reintroduced in the previous commit.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
parent
6b48829dbb
commit
eaa14ff8c7
13
git-svn.perl
13
git-svn.perl
@ -665,12 +665,25 @@ sub cmd_branch {
|
|||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unless (defined $glob) {
|
||||||
|
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) {
|
unless (defined $glob) {
|
||||||
die "Unknown ",
|
die "Unknown ",
|
||||||
$_tag ? "tag" : "branch",
|
$_tag ? "tag" : "branch",
|
||||||
" destination $_branch_dest\n";
|
" destination $_branch_dest\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
|
my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
|
||||||
my $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());
|
my $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());
|
||||||
|
|
||||||
|
@ -99,22 +99,22 @@ test_expect_success 'Multiple branch or tag paths require -d' '
|
|||||||
|
|
||||||
test_expect_success 'create new branches and tags' '
|
test_expect_success 'create new branches and tags' '
|
||||||
( cd git_project &&
|
( 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 &&
|
( cd svn_project &&
|
||||||
svn_cmd up && test -e b_one/New1/a.file ) &&
|
svn_cmd up && test -e b_one/New1/a.file ) &&
|
||||||
|
|
||||||
( cd git_project &&
|
( 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 &&
|
( cd svn_project &&
|
||||||
svn_cmd up && test -e b_two/New2/a.file ) &&
|
svn_cmd up && test -e b_two/New2/a.file ) &&
|
||||||
|
|
||||||
( cd git_project &&
|
( 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 &&
|
( cd svn_project &&
|
||||||
svn_cmd up && test -e tags_A/Tag1/a.file ) &&
|
svn_cmd up && test -e tags_A/Tag1/a.file ) &&
|
||||||
|
|
||||||
( cd git_project &&
|
( 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 &&
|
( cd svn_project &&
|
||||||
svn_cmd up && test -e tags_B/Tag2/a.file )
|
svn_cmd up && test -e tags_B/Tag2/a.file )
|
||||||
'
|
'
|
||||||
|
Loading…
Reference in New Issue
Block a user