[PATCH] cvsimport-in-Perl: Limit the number of arguments to git-update-cache
From: Matthias Urlichs <hidden>
Date: 2016-06-15 22:42:01
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> ---
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 /^-+$/) {