Skip to content

Commit 1bf0104

Browse files
moygitster
authored andcommitted
add -p: demonstrate failure when running 'edit' after a split
The test passes if one replaces the 'e' command with a 'y' command in the 'add -p' session. Reported-by: Tanky Woo <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 416145f commit 1bf0104

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

t/t3701-add-interactive.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,28 @@ test_expect_success 'split hunk "add -p (edit)"' '
332332
! grep "^+15" actual
333333
'
334334

335+
test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
336+
cat >test <<-\EOF &&
337+
5
338+
10
339+
20
340+
21
341+
30
342+
31
343+
40
344+
50
345+
60
346+
EOF
347+
git reset &&
348+
# test sequence is s(plit), n(o), y(es), e(dit)
349+
# q n q q is there to make sure we exit at the end.
350+
printf "%s\n" s n y e q n q q |
351+
EDITOR=: git add -p 2>error &&
352+
test_must_be_empty error &&
353+
git diff >actual &&
354+
! grep "^+31" actual
355+
'
356+
335357
test_expect_success 'patch mode ignores unmerged entries' '
336358
git reset --hard &&
337359
test_commit conflict &&

0 commit comments

Comments
 (0)