login
Header Space

 
 

Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Sasha Khapyorsky <sashak@...>
Cc: <git@...>, Matthias Urlichs <smurf@...>
Date: Wednesday, February 1, 2006 - 6:50 pm

Sasha Khapyorsky <sashak@voltaire.com> writes:


I was commenting on the "while (@o1)" loop that splices at 50
when the list has more than 55 items to feed update-index.  You
could accumulate output from multiple invocations of ls-files
and feed everything to a single "update-index --stdin" after the
"while (@old)" loop is done.  Batch of 50 vs a single batch may
not matter though [*1*].

But you are right; that git-ls-files can get too many arguments
unless you split like that.

A casual skimming over the rest of the code tells me that this
fixes the last instance of such a command invocation with too
many arguments.  Good catch.

Smurf, I do not have problems with Sasha's patch.  Are you OK
if I apply it?


-- >8 --

*1* I do not think this makes much of a difference but here is what
I mean.

diff --git a/git-svnimport.perl b/git-svnimport.perl
index b6799d8..d76a595 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -546,7 +546,8 @@ sub commit {
 			}
 		}
 
-		while(@old) {
+		my @u = ();
+		while (@old) {
 			my @o1;
 			if(@old > 55) {
 				@o1 = splice(@old,0,50);
@@ -555,26 +556,19 @@ sub commit {
 				@old = ();
 			}
 			open my $F, "-|", "git-ls-files", "-z", @o1 or die $!;
-			@o1 = ();
 			local $/ = "\0";
 			while(<$F>) {
 				chomp;
-				push(@o1,$_);
+				push(@u,$_);
 			}
 			close($F);
-
-			while(@o1) {
-				my @o2;
-				if(@o1 > 55) {
-					@o2 = splice(@o1,0,50);
-				} else {
-					@o2 = @o1;
-					@o1 = ();
-				}
-				system("git-update-index","--force-remove","--",@o2);
-				die "Cannot remove files: $?\n" if $?;
-			}
 		}
+		open my $F, "|-",
+			qw(git-update-index --force-remove -z --stdin)
+				or die $!;
+		print $F "$_\0" for @u;
+		close $F or die $!;
+
 		while(@new) {
 			my @n2;
 			if(@new > 12) {


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...', Junio C Hamano, (Wed Feb 1, 6:50 pm)
speck-geostationary