[PATCH] cvsimport-in-Perl: Limit the number of arguments to git-update-cache
- From
Matthias Urlichs <smurf@smurf.noris.de>
- Date
- Jun 30, 2005, 10:34 UTC
- Message-ID
- <pan.2005.06.30.10.34.00.807346@smurf.noris.de>
- In-Reply-To
- <pan.2005.06.28.19.23.08.307486@smurf.noris.de>
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 /^-+$/) {