summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-12-03 00:19:31 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-03 01:25:34 (GMT)
commit6173c197c9a23fa8594f18fd2c856407d4af31c1 (patch)
tree5fc454c59853f6eb92548a72cc4d440a7b555f3c /git-svn.perl
parenteb07fd59acae0f043b9fac2a8a1cb427036c6f71 (diff)
downloadgit-6173c197c9a23fa8594f18fd2c856407d4af31c1.zip
git-6173c197c9a23fa8594f18fd2c856407d4af31c1.tar.gz
git-6173c197c9a23fa8594f18fd2c856407d4af31c1.tar.bz2
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 <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl10
1 files changed, 5 insertions, 5 deletions
diff --git a/git-svn.perl b/git-svn.perl
index bb8935a..b53273e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2778,7 +2778,7 @@ sub process_rm {
sub libsvn_fetch {
my ($last_commit, $paths, $rev, $author, $date, $msg) = @_;
open my $gui, '| git-update-index -z --index-info' or croak $!;
- my @amr;
+ my %amr;
foreach my $f (keys %$paths) {
my $m = $paths->{$f}->action();
$f =~ s#^/+##;
@@ -2792,7 +2792,7 @@ sub libsvn_fetch {
my $t = $SVN->check_path($f, $rev, $pool);
if ($t == $SVN::Node::file) {
if ($m =~ /^[AMR]$/) {
- push @amr, [ $m, $f ];
+ $amr{$f} = $m;
} else {
die "Unrecognized action: $m, ($f r$rev)\n";
}
@@ -2800,13 +2800,13 @@ sub libsvn_fetch {
my @traversed = ();
libsvn_traverse($gui, '', $f, $rev, \@traversed);
foreach (@traversed) {
- push @amr, [ $m, $_ ]
+ $amr{$_} = $m;
}
}
$pool->clear;
}
- foreach (@amr) {
- libsvn_get_file($gui, $_->[1], $rev, $_->[0]);
+ foreach (keys %amr) {
+ libsvn_get_file($gui, $_, $rev, $amr{$_});
}
close $gui or croak $?;
return libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);