diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-11 22:37:46 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-11 22:37:46 +0400 |
commit | f3b173daf400813c7f587a011290dac31de2b68e (patch) | |
tree | 588db086f294f64dd97a51b90d8fe2f60c17b6c1 /t/t3701-add-interactive.sh | |
parent | 9cd805de613c5984432acb778636f44d0fb596f8 (diff) | |
parent | 0bf9fc0cd28bf8e983a5280676fcaeb826403516 (diff) |
Merge branch 'jc/maint-add-p-overlapping-hunks'
* jc/maint-add-p-overlapping-hunks:
t3701: add-p-fix makes the last test to pass
"add -p": work-around an old laziness that does not coalesce hunks
add--interactive.perl: factor out repeated --recount option
t3701: Editing a split hunk in an "add -p" session
add -p: 'q' should really quit
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-x | t/t3701-add-interactive.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index fdcbe2e736..9e236f9cc0 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -294,4 +294,40 @@ test_expect_success PERL 'deleting an empty file' ' test_cmp expected diff ' +test_expect_success PERL 'split hunk setup' ' + git reset --hard && + for i in 10 20 30 40 50 60 + do + echo $i + done >test && + git add test && + test_tick && + git commit -m test && + + for i in 10 15 20 21 22 23 24 30 40 50 60 + do + echo $i + done >test +' + +test_expect_success PERL 'split hunk "add -p (edit)"' ' + # Split, say Edit and do nothing. Then: + # + # 1. Broken version results in a patch that does not apply and + # only takes [y/n] (edit again) so the first q is discarded + # and then n attempts to discard the edit. Repeat q enough + # times to get out. + # + # 2. Correct version applies the (not)edited version, and asks + # about the next hunk, against wich we say q and program + # exits. + for a in s e q n q q + do + echo $a + done | + EDITOR=: git add -p && + git diff >actual && + ! grep "^+15" actual +' + test_done |