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