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 <wtq1990@gmail.com> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthieu Moy committed Apr 16, 2015 at 09:02 UTC 1bf01040f0c1101f410f9caa5e715460cdd0cbe0
1 file changed +22
t/t3701-add-interactive.sh
+22
@@ -332,6 +332,28 @@ test_expect_success 'split hunk "add -p (edit)"' '
332 ! grep "^+15" actual
333 '
334
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 +
357 test_expect_success 'patch mode ignores unmerged entries' '
358 git reset --hard &&
359 test_commit conflict &&