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 {
841841 my ($last_o_ctx , $last_was_dirty );
842842
843843 for (grep { $_ -> {USE } } @in ) {
844+ if ($_ -> {TYPE } ne ' hunk' ) {
845+ push @out , $_ ;
846+ next ;
847+ }
844848 my $text = $_ -> {TEXT };
845849 my ($o_ofs ) = parse_hunk_header($text -> [0]);
846850 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' '
163163 git diff file | grep "+content"
164164'
165165
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+
166177# end of tests disabled when filemode is not usable
167178
168179test_expect_success ' setup again' '
You can’t perform that action at this time.
0 commit comments