Skip to content

Commit 6173c19

Browse files
Eric WongJunio C Hamano
authored andcommitted
git-svn: avoid fetching files twice in the same revision
SVN is not entirely consistent in returning log information and sometimes returns file information when adding subdirectories, and sometimes it does not (only returning information about the directory that was added). This caused git-svn to occasionally add a file to the list of files to be fetched twice. Now we change the data structure to be hash to avoid repeated fetches. As of now (in master), this only affects repositories fetched without deltas enabled (file://, and when manually overriden with GIT_SVN_DELTA_FETCH=0); so this bug mainly affects users of 1.4.4.1 and maint. Thanks to Florian Weimer for reporting this bug. [jc: backported for maint] Signed-off-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eb07fd5 commit 6173c19

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git-svn.perl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,7 @@ sub process_rm {
27782778
sub libsvn_fetch {
27792779
my ($last_commit, $paths, $rev, $author, $date, $msg) = @_;
27802780
open my $gui, '| git-update-index -z --index-info' or croak $!;
2781-
my @amr;
2781+
my %amr;
27822782
foreach my $f (keys %$paths) {
27832783
my $m = $paths->{$f}->action();
27842784
$f =~ s#^/+##;
@@ -2792,21 +2792,21 @@ sub libsvn_fetch {
27922792
my $t = $SVN->check_path($f, $rev, $pool);
27932793
if ($t == $SVN::Node::file) {
27942794
if ($m =~ /^[AMR]$/) {
2795-
push @amr, [ $m, $f ];
2795+
$amr{$f} = $m;
27962796
} else {
27972797
die "Unrecognized action: $m, ($f r$rev)\n";
27982798
}
27992799
} elsif ($t == $SVN::Node::dir && $m =~ /^[AR]$/) {
28002800
my @traversed = ();
28012801
libsvn_traverse($gui, '', $f, $rev, \@traversed);
28022802
foreach (@traversed) {
2803-
push @amr, [ $m, $_ ]
2803+
$amr{$_} = $m;
28042804
}
28052805
}
28062806
$pool->clear;
28072807
}
2808-
foreach (@amr) {
2809-
libsvn_get_file($gui, $_->[1], $rev, $_->[0]);
2808+
foreach (keys %amr) {
2809+
libsvn_get_file($gui, $_, $rev, $amr{$_});
28102810
}
28112811
close $gui or croak $?;
28122812
return libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);

0 commit comments

Comments
 (0)