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:
Eric Wong
2009-07-25 01:36:06 -07:00
parent 6b48829dbb
commit eaa14ff8c7
2 changed files with 20 additions and 7 deletions

View File

@ -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/};