diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-05-11 14:23:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-11 14:23:47 -0700 |
commit | 331fe94fedb40851de29f0954026c705118102b3 (patch) | |
tree | bc606370038901227d64785687e523bfcd1cf9c5 /t/t3701-add-interactive.sh | |
parent | Merge branch 'tb/t0027-crlf' (diff) | |
parent | stash -p: demonstrate failure of split with mixed y/n (diff) | |
download | tgif-331fe94fedb40851de29f0954026c705118102b3.tar.xz |
Merge branch 'mm/add-p-split-error'
When "add--interactive" splits a hunk into two overlapping hunks
and then let the user choose only one, it sometimes feeds an
incorrect patch text to "git apply". Add tests to demonstrate
this.
I have a slight suspicion that this may be $gmane/87202 coming back
and biting us (I seem to have said "let's run with this and see
what happens" back then).
* mm/add-p-split-error:
stash -p: demonstrate failure of split with mixed y/n
t3904-stash-patch: factor PERL prereq at the top of the file
t3904-stash-patch: fix test description
add -p: demonstrate failure when running 'edit' after a split
t3701-add-interactive: simplify code
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-x | t/t3701-add-interactive.sh | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 24ddd8a704..deae948c76 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -326,15 +326,34 @@ test_expect_success 'split hunk "add -p (edit)"' ' # 2. Correct version applies the (not)edited version, and asks # about the next hunk, against which we say q and program # exits. - for a in s e q n q q - do - echo $a - done | + printf "%s\n" s e q n q q | EDITOR=: git add -p && git diff >actual && ! grep "^+15" actual ' +test_expect_failure 'split hunk "add -p (no, yes, edit)"' ' + cat >test <<-\EOF && + 5 + 10 + 20 + 21 + 30 + 31 + 40 + 50 + 60 + EOF + git reset && + # test sequence is s(plit), n(o), y(es), e(dit) + # q n q q is there to make sure we exit at the end. + printf "%s\n" s n y e q n q q | + EDITOR=: git add -p 2>error && + test_must_be_empty error && + git diff >actual && + ! grep "^+31" actual +' + test_expect_success 'patch mode ignores unmerged entries' ' git reset --hard && test_commit conflict && |