X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-svn.perl;h=9b046b693fe82c992b3844bf6e8f79214dfa7a59;hb=e32dfec79f99738df3c2ffca8a9b2257c9b681fb;hp=34884b8fce37008ca05369dbd365573c7112ca21;hpb=a9c6305a7c14c0d5a49c485672b60526ec082d8c;p=git.git diff --git a/git-svn.perl b/git-svn.perl index 34884b8fc..9b046b693 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2959,18 +2959,29 @@ sub other_gs { my $gs = Git::SVN->find_by_url($new_url, $url, $branch_from); unless ($gs) { my $ref_id = $old_ref_id; - $ref_id =~ s/\@\d+$//; + $ref_id =~ s/\@\d+-*$//; $ref_id .= "\@$r"; # just grow a tail if we're not unique enough :x $ref_id .= '-' while find_ref($ref_id); - print STDERR "Initializing parent: $ref_id\n" unless $::_q > 1; my ($u, $p, $repo_id) = ($new_url, '', $ref_id); if ($u =~ s#^\Q$url\E(/|$)##) { $p = $u; $u = $url; $repo_id = $self->{repo_id}; } - $gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1); + while (1) { + # It is possible to tag two different subdirectories at + # the same revision. If the url for an existing ref + # does not match, we must either find a ref with a + # matching url or create a new ref by growing a tail. + $gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1); + my (undef, $max_commit) = $gs->rev_map_max(1); + last if (!$max_commit); + my ($url) = ::cmt_metadata($max_commit); + last if ($url eq $gs->full_url); + $ref_id .= '-'; + } + print STDERR "Initializing parent: $ref_id\n" unless $::_q > 1; } $gs }