stash: add a test for when apply fails during stash branch

If the return value of merge recursive is not checked, the stash could end up being dropped even though it was not applied properly Signed-off-by: Joel Teichroeb <joel@teichroeb.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Joel Teichroeb committed Aug 19, 2017 at 13:13 UTC b04e6915fa047bb3103e5be83953f2ca0b4b115b
1 file changed +14
t/t3903-stash.sh
+14
@@ -656,6 +656,20 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
656 git rev-parse stash@{0} --
657 '
658
659 +test_expect_success 'stash branch should not drop the stash if the apply fails' '
660 + git stash clear &&
661 + git reset HEAD~1 --hard &&
662 + echo foo >file &&
663 + git add file &&
664 + git commit -m initial &&
665 + echo bar >file &&
666 + git stash &&
667 + echo baz >file &&
668 + test_when_finished "git checkout master" &&
669 + test_must_fail git stash branch new_branch stash@{0} &&
670 + git rev-parse stash@{0} --
671 +'
672 +
673 test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
674 git stash clear &&
675 echo 1 >subdir/subfile1 &&