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

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

From
SKSasha Khapyorsky <sashak@voltaire.com>
Date
Feb 1, 2006, 15:53 UTC
Message-ID
<20060201155331.GE18078@sashak.voltaire.com>
Hello,
This fixes 'arg list too long' problem when passed to git-ls-files.
Sasha.
This fixes 'arg list too long..' problem with git-ls-files.

Note that second arg list separation loop (with 'git-update-index') is needed since git-ls-files arguments can be directories.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 6e3a44a..b6799d8 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -546,23 +546,30 @@ sub commit {
 			}
 		}
 
-		if(@old) {
-			open my $F, "-|", "git-ls-files", "-z", @old or die $!;
-			@old = ();
+		while(@old) {
+			my @o1;
+			if(@old > 55) {
+				@o1 = splice(@old,0,50);
+			} else {
+				@o1 = @old;
+				@old = ();
+			}
+			open my $F, "-|", "git-ls-files", "-z", @o1 or die $!;
+			@o1 = ();
 			local $/ = "\0";
 			while(<$F>) {
 				chomp;
-				push(@old,$_);
+				push(@o1,$_);
 			}
 			close($F);
 
-			while(@old) {
+			while(@o1) {
 				my @o2;
-				if(@old > 55) {
-					@o2 = splice(@old,0,50);
+				if(@o1 > 55) {
+					@o2 = splice(@o1,0,50);
 				} else {
-					@o2 = @old;
-					@old = ();
+					@o2 = @o1;
+					@o1 = ();
 				}
 				system("git-update-index","--force-remove","--",@o2);
 				die "Cannot remove files: $?\n" if $?;
Next: Junio C Hamano
Message 1 of 6 in “git-svnimport.perl: fix for 'arg list too long...'”
  1. git-svnimport.perl: fix for 'arg list too long...'Sasha Khapyorsky, Feb 1, 2006
  2. Junio C HamanoFeb 1, 2006
  3. Sasha KhapyorskyFeb 1, 2006
  4. Junio C HamanoFeb 1, 2006
  5. Matthias UrlichsFeb 1, 2006
  6. Sasha KhapyorskyFeb 2, 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.