File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,24 @@ sub run_cmd_pipe {
174
174
die " $^O does not support: @invalid \n" if @invalid ;
175
175
my @args = map { m/ /o ? " \" $_ \" " : $_ } @_ ;
176
176
return qx{ @args } ;
177
+ } elsif (($^O eq ' MSWin32' || $^O eq ' msys' ) && (scalar @_ > 200) &&
178
+ grep $_ eq ' --' , @_ ) {
179
+ use File::Temp qw( tempfile) ;
180
+ my ($fhargs , $filename ) =
181
+ tempfile(' git-args-XXXXXX' , UNLINK => 1);
182
+
183
+ my $cmd = ' cat ' .$filename .' | xargs -0 -s 20000 ' ;
184
+ while ($_ [0] ne ' --' ) {
185
+ $cmd = $cmd . shift (@_ ) . ' ' ;
186
+ }
187
+
188
+ shift (@_ );
189
+ print $fhargs join (" \0 " , @_ );
190
+ close ($fhargs );
191
+
192
+ my $fh = undef ;
193
+ open ($fh , ' -|' , $cmd ) or die ;
194
+ return <$fh >;
177
195
} else {
178
196
my $fh = undef ;
179
197
open ($fh , ' -|' , @_ ) or die ;
Original file line number Diff line number Diff line change @@ -740,6 +740,27 @@ test_expect_success 'add -p patch editing works with pathological context lines'
740
740
test_cmp expected-2 actual
741
741
'
742
742
743
+ test_expect_success EXPENSIVE ' add -i with a lot of files' '
744
+ git reset --hard &&
745
+ x160=0123456789012345678901234567890123456789 &&
746
+ x160=$x160$x160$x160$x160 &&
747
+ y= &&
748
+ i=0 &&
749
+ while test $i -le 200
750
+ do
751
+ name=$(printf "%s%03d" $x160 $i) &&
752
+ echo $name >$name &&
753
+ git add -N $name &&
754
+ y="${y}y$LF" &&
755
+ i=$(($i+1)) ||
756
+ break
757
+ done &&
758
+ echo "$y" | git add -p -- . &&
759
+ git diff --cached >staged &&
760
+ test_line_count = 1407 staged &&
761
+ git reset --hard
762
+ '
763
+
743
764
test_expect_success ' show help from add--helper' '
744
765
git reset --hard &&
745
766
cat >expect <<-EOF &&
You can’t perform that action at this time.
0 commit comments