@matheusbsbs / matheus-bagliano / commits / d0d8f7dc5f
Fork 0

git-svn: fix fetching new directories copies when using SVN:: libs

Log output from SVN doesn't list all the new files that were added if a new directory was copied from an existing place in the repository. This means we'll have to do some extra work and traverse new directories ourselves. This has been updated from the original patch to defer traversed adds until all removals have been done. Please disregard the original. Thanks to Ben Williamson for the excellent bug report and testing. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric Wong committed Jul 20, 2006 at 01:43 UTC d0d8f7dc5ffe029d3fc047fb7ffecd7ecfb6601c
1 file changed +16 -7
git-svn.perl
+16 -7
@@ -2709,6 +2709,12 @@ sub libsvn_fetch {
2709 } else {
2710 die "Unrecognized action: $m, ($f r$rev)\n";
2711 }
2712 + } elsif ($t == $SVN::Node::dir && $m =~ /^[AR]$/) {
2713 + my @traversed = ();
2714 + libsvn_traverse($gui, '', $f, $rev, \@traversed);
2715 + foreach (@traversed) {
2716 + push @amr, [ $m, $_ ]
2717 + }
2718 }
2719 $pool->clear;
2720 }
@@ -2778,7 +2784,7 @@ sub libsvn_parse_revision {
2784 }
2785
2786 sub libsvn_traverse {
2781 - my ($gui, $pfx, $path, $rev) = @_;
2787 + my ($gui, $pfx, $path, $rev, $files) = @_;
2788 my $cwd = "$pfx/$path";
2789 my $pool = SVN::Pool->new;
2790 $cwd =~ s#^/+##g;
@@ -2786,10 +2792,15 @@ sub libsvn_traverse {
2792 foreach my $d (keys %$dirent) {
2793 my $t = $dirent->{$d}->kind;
2794 if ($t == $SVN::Node::dir) {
2789 - libsvn_traverse($gui, $cwd, $d, $rev);
2795 + libsvn_traverse($gui, $cwd, $d, $rev, $files);
2796 } elsif ($t == $SVN::Node::file) {
2791 - print "\tA\t$cwd/$d\n" unless $_q;
2792 - libsvn_get_file($gui, "$cwd/$d", $rev);
2797 + my $file = "$cwd/$d";
2798 + if (defined $files) {
2799 + push @$files, $file;
2800 + } else {
2801 + print "\tA\t$file\n" unless $_q;
2802 + libsvn_get_file($gui, $file, $rev);
2803 + }
2804 }
2805 }
2806 $pool->clear;
@@ -2913,9 +2924,7 @@ sub libsvn_new_tree {
2924 }
2925 my ($paths, $rev, $author, $date, $msg) = @_;
2926 open my $gui, '| git-update-index -z --index-info' or croak $!;
2916 - my $pool = SVN::Pool->new;
2917 - libsvn_traverse($gui, '', $SVN_PATH, $rev, $pool);
2918 - $pool->clear;
2927 + libsvn_traverse($gui, '', $SVN_PATH, $rev);
2928 close $gui or croak $?;
2929 return libsvn_log_entry($rev, $author, $date, $msg);
2930 }