summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorJoel Teichroeb <joel@teichroeb.net>2017-08-19 20:13:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-19 21:03:56 (GMT)
commitb04e6915fa047bb3103e5be83953f2ca0b4b115b (patch)
treec9a7535c80dbbf787df59525292eefa36b24a8f5 /t/t3903-stash.sh
parentc95bc226d4ccc313303f700f11815c03fbec4efc (diff)
downloadgit-b04e6915fa047bb3103e5be83953f2ca0b4b115b.zip
git-b04e6915fa047bb3103e5be83953f2ca0b4b115b.tar.gz
git-b04e6915fa047bb3103e5be83953f2ca0b4b115b.tar.bz2
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>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-xt/t3903-stash.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index f0708ce..887010c 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -656,6 +656,20 @@ test_expect_success 'stash branch should not drop the stash if the branch exists
git rev-parse stash@{0} --
'
+test_expect_success 'stash branch should not drop the stash if the apply fails' '
+ git stash clear &&
+ git reset HEAD~1 --hard &&
+ echo foo >file &&
+ git add file &&
+ git commit -m initial &&
+ echo bar >file &&
+ git stash &&
+ echo baz >file &&
+ test_when_finished "git checkout master" &&
+ test_must_fail git stash branch new_branch stash@{0} &&
+ git rev-parse stash@{0} --
+'
+
test_expect_success 'stash apply shows status same as git status (relative to current directory)' '
git stash clear &&
echo 1 >subdir/subfile1 &&