git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Re: git-svn: Missing files

From
EWEric Wong <normalperson@yhbt.net>
Date
Jul 20, 2006, 03:48 UTC
Message-ID
<20060720034841.GA28298@localdomain>
In-Reply-To
<b6327a230607191902n47b81993x8caea2df3955d8c0@mail.gmail.com>

Ben, can you please try this patch against the git-svn.perl file in master? You can also find the full patched file here:

	http://git-svn.bogomips.org/git-svn.perl
From: Eric Wong <normalperson@yhbt.net>
Date: Wed, 19 Jul 2006 20:42:35 -0700
Subject: [PATCH] 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.

Thanks to Ben Williamson for the excellent bug report.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 89ad840..577a284 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2692,6 +2692,7 @@ 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 %fetched = ();
 	foreach my $f (keys %$paths) {
 		my $m = $paths->{$f}->action();
 		$f =~ s#^/+##;
@@ -2709,10 +2710,13 @@ sub libsvn_fetch {
 			} else {
 				die "Unrecognized action: $m, ($f r$rev)\n";
 			}
+		} elsif ($t == $SVN::Node::dir && $m =~ /^[AR]$/) {
+			libsvn_traverse($gui, '', $f, $rev, \%fetched);
 		}
 		$pool->clear;
 	}
 	foreach (@amr) {
+		next if $fetched{$_->[1]};
 		print "\t$_->[0]\t$_->[1]\n" unless $_q;
 		libsvn_get_file($gui, $_->[1], $rev)
 	}
@@ -2778,7 +2782,7 @@ sub libsvn_parse_revision {
 }
 
 sub libsvn_traverse {
-	my ($gui, $pfx, $path, $rev) = @_;
+	my ($gui, $pfx, $path, $rev, $files) = @_;
 	my $cwd = "$pfx/$path";
 	my $pool = SVN::Pool->new;
 	$cwd =~ s#^/+##g;
@@ -2786,10 +2790,12 @@ sub libsvn_traverse {
 	foreach my $d (keys %$dirent) {
 		my $t = $dirent->{$d}->kind;
 		if ($t == $SVN::Node::dir) {
-			libsvn_traverse($gui, $cwd, $d, $rev);
+			libsvn_traverse($gui, $cwd, $d, $rev, $files);
 		} elsif ($t == $SVN::Node::file) {
-			print "\tA\t$cwd/$d\n" unless $_q;
-			libsvn_get_file($gui, "$cwd/$d", $rev);
+			my $file = "$cwd/$d";
+			print "\tA\t$file\n" unless $_q;
+			libsvn_get_file($gui, $file, $rev);
+			$files->{$file} = 1 if defined $files;
 		}
 	}
 	$pool->clear;
@@ -2913,9 +2919,7 @@ sub libsvn_new_tree {
 	}
 	my ($paths, $rev, $author, $date, $msg) = @_;
 	open my $gui, '| git-update-index -z --index-info' or croak $!;
-	my $pool = SVN::Pool->new;
-	libsvn_traverse($gui, '', $SVN_PATH, $rev, $pool);
-	$pool->clear;
+	libsvn_traverse($gui, '', $SVN_PATH, $rev);
 	close $gui or croak $?;
 	return libsvn_log_entry($rev, $author, $date, $msg);
 }
-- 
1.4.1.g9d8f
Previous: Ben WilliamsonNext: Ben Williamson
Message 6 of 9 in “git-svn: Missing files”
  1. Ben WilliamsonJul 20, 2006
  2. Ben WilliamsonJul 20, 2006
  3. Eric WongJul 20, 2006
  4. Eric WongJul 20, 2006
  5. Ben WilliamsonJul 20, 2006
  6. Re: git-svn: Missing filesEric Wong, Jul 20, 2006
  7. Ben WilliamsonJul 20, 2006
  8. git-svn: fix fetching new directories copies when using SVN:: libsEric Wong, Jul 20, 2006
  9. Junio C HamanoJul 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.