X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-svn.perl;h=24bdbf5b813ddd6c7f242189b9bb22fbe7dfff11;hb=cfe370c6476392095bc3f18013d195b1cccd6184;hp=10b77ad34c1103fc8dd390db9937496e41716fdf;hpb=6b48829dbbe06798eded1e7c5f70810940591f79;p=git.git diff --git a/git-svn.perl b/git-svn.perl index 10b77ad34..24bdbf5b8 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/}; @@ -2797,6 +2810,7 @@ sub other_gs { sub call_authors_prog { my ($orig_author) = @_; + $orig_author = command_oneline('rev-parse', '--sq-quote', $orig_author); my $author = `$::_authors_prog $orig_author`; if ($? != 0) { die "$::_authors_prog failed with exit code $?\n" @@ -3992,7 +4006,7 @@ sub repo_path { sub url_path { my ($self, $path) = @_; if ($self->{url} =~ m#^https?://#) { - $path =~ s/([^~a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; + $path =~ s!([^~a-zA-Z0-9_./-])!uc sprintf("%%%02x",ord($1))!eg; } $self->{url} . '/' . $self->repo_path($path); } @@ -4818,7 +4832,11 @@ sub minimize_url { my $c = ''; do { $url .= "/$c" if length $c; - eval { (ref $self)->new($url)->get_latest_revnum }; + eval { + my $ra = (ref $self)->new($url); + my $latest = $ra->get_latest_revnum; + $ra->get_log("", $latest, 0, 1, 0, 1, sub {}); + }; } while ($@ && ($c = shift @components)); $url; }