Skip to content

Commit c586879

Browse files
Eric Wonggitster
authored andcommitted
git-svn: improve repository URL matching when following parents
This way we can avoid the spawning of a new SVN::Ra session by reusing the existing one. The most problematic issue is that some svn servers disallow too many connections from a single IP, so this will allow git-svn to fetch from those repositories with a higher success rate by using fewer connections. This sometimes showed up as a new (and redundant) [svn-remote "$parent_refname"] entry in $GIT_DIR/svn/.metadata. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7deaec9 commit c586879

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

git-svn.perl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2229,7 +2229,12 @@ sub find_parent_branch {
22292229
# just grow a tail if we're not unique enough :x
22302230
$ref_id .= '-' while find_ref($ref_id);
22312231
print STDERR "Initializing parent: $ref_id\n";
2232-
$gs = Git::SVN->init($new_url, '', $ref_id, $ref_id, 1);
2232+
my ($u, $p) = ($new_url, '');
2233+
if ($u =~ s#^\Q$url\E(/|$)##) {
2234+
$p = $u;
2235+
$u = $url;
2236+
}
2237+
$gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1);
22332238
}
22342239
my ($r0, $parent) = $gs->find_rev_before($r, 1);
22352240
if (!defined $r0 || !defined $parent) {

0 commit comments

Comments
 (0)