File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,24 @@ sub run_cmd_pipe {
177
177
die " $^O does not support: @invalid \n" if @invalid ;
178
178
my @args = map { m/ /o ? " \" $_ \" " : $_ } @_ ;
179
179
return qx{ @args } ;
180
+ } elsif (($^O eq ' MSWin32' || $^O eq ' msys' ) && (scalar @_ > 200) &&
181
+ grep $_ eq ' --' , @_ ) {
182
+ use File::Temp qw( tempfile) ;
183
+ my ($fhargs , $filename ) =
184
+ tempfile(' git-args-XXXXXX' , UNLINK => 1);
185
+
186
+ my $cmd = ' cat ' .$filename .' | xargs -0 -s 20000 ' ;
187
+ while ($_ [0] ne ' --' ) {
188
+ $cmd = $cmd . shift (@_ ) . ' ' ;
189
+ }
190
+
191
+ shift (@_ );
192
+ print $fhargs join (" \0 " , @_ );
193
+ close ($fhargs );
194
+
195
+ my $fh = undef ;
196
+ open ($fh , ' -|' , $cmd ) or die ;
197
+ return <$fh >;
180
198
} else {
181
199
my $fh = undef ;
182
200
open ($fh , ' -|' , @_ ) or die ;
Original file line number Diff line number Diff line change @@ -380,4 +380,25 @@ test_expect_success 'patch mode ignores unmerged entries' '
380
380
test_cmp expected diff
381
381
'
382
382
383
+ test_expect_success EXPENSIVE ' add -i with a lot of files' '
384
+ git reset --hard &&
385
+ x160=0123456789012345678901234567890123456789 &&
386
+ x160=$x160$x160$x160$x160 &&
387
+ y= &&
388
+ i=0 &&
389
+ while test $i -le 200
390
+ do
391
+ name=$(printf "%s%03d" $x160 $i) &&
392
+ echo $name >$name &&
393
+ git add -N $name &&
394
+ y="${y}y$LF" &&
395
+ i=$(($i+1)) ||
396
+ break
397
+ done &&
398
+ echo "$y" | git add -p -- . &&
399
+ git diff --cached >staged &&
400
+ test_line_count = 1407 staged &&
401
+ git reset --hard
402
+ '
403
+
383
404
test_done
You can’t perform that action at this time.
0 commit comments