File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -841,6 +841,10 @@ sub coalesce_overlapping_hunks {
841
841
my ($last_o_ctx , $last_was_dirty );
842
842
843
843
for (grep { $_ -> {USE } } @in ) {
844
+ if ($_ -> {TYPE } ne ' hunk' ) {
845
+ push @out , $_ ;
846
+ next ;
847
+ }
844
848
my $text = $_ -> {TEXT };
845
849
my ($o_ofs ) = parse_hunk_header($text -> [0]);
846
850
if (defined $last_o_ctx &&
Original file line number Diff line number Diff line change @@ -163,6 +163,17 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
163
163
git diff file | grep "+content"
164
164
'
165
165
166
+
167
+ test_expect_success FILEMODE ' stage mode and hunk' '
168
+ git reset --hard &&
169
+ echo content >>file &&
170
+ chmod +x file &&
171
+ printf "y\\ny\\n" | git add -p &&
172
+ git diff --cached file | grep "new mode" &&
173
+ git diff --cached file | grep "+content" &&
174
+ test -z "$(git diff file)"
175
+ '
176
+
166
177
# end of tests disabled when filemode is not usable
167
178
168
179
test_expect_success ' setup again' '
You can’t perform that action at this time.
0 commit comments