[PATCH] cvsimport-in-Perl: Limit the number of arguments to git-update-cache

From: Matthias Urlichs <smurf@smurf.noris.de>
Date: 2005-06-30 20:34:00
A small fix to git-cvsimport-script:

Limit the number of arguments to git-update-cache.
(Limiting their length may make a bit more sense, but I'm lazy.)

Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>

---

diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -395,14 +395,32 @@ my $state = 0;
 
 my($patchset,$date,$author,$branch,$ancestor,$tag,$logmsg);
 my(@old,@new);
 my $commit = sub {
 	my $pid;
-	system("git-update-cache","--force-remove","--",@old) if @old;
-	die "Cannot remove files: $?\n" if $?;
-	system("git-update-cache","--add","--",@new) if @new;
-	die "Cannot add files: $?\n" if $?;
+	while(@old) {
+		my @o2;
+		if(@old > 55) {
+			@o2 = splice(@old,0,50);
+		} else {
+			@o2 = @old;
+			@old = ();
+		}
+		system("git-update-cache","--force-remove","--",@o2);
+		die "Cannot remove files: $?\n" if $?;
+	}
+	while(@new) {
+		my @n2;
+		if(@new > 55) {
+			@n2 = splice(@new,0,50);
+		} else {
+			@n2 = @new;
+			@new = ();
+		}
+		system("git-update-cache","--add","--",@n2);
+		die "Cannot add files: $?\n" if $?;
+	}
 
 	$pid = open(C,"-|");
 	die "Cannot fork: $!" unless defined $pid;
 	unless($pid) {
 		exec("git-write-tree");
@@ -478,13 +496,10 @@ my $commit = sub {
 			or die "Cannot write tag $branch: $!\n";
 		close(C)
 			or die "Cannot write tag $branch: $!\n";
 		print "Created tag '$tag' on '$branch'\n" if $opt_v;
 	}
-
-	@old = ();
-	@new = ();
 };
 
 while(<CVS>) {
 	chomp;
 	if($state == 0 and /^-+$/) {


-
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
Received on Thu Jun 30 20:43:56 2005

This archive was generated by hypermail 2.1.8 : 2005-06-30 20:44:00 EST