summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorTomas Carnecky <tom@dbservice.com>2010-09-28 13:19:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-29 16:59:42 (GMT)
commit835d6a1f9f6f0f6e47cf32238af7ee8b8d048d78 (patch)
treedd3d741a4bc4cceff0ed0ef9aa15b18ad2bd383c /t/t3903-stash.sh
parent442cb08fa0dca38c99cf1ff8a5654a95a5cad7a4 (diff)
downloadgit-835d6a1f9f6f0f6e47cf32238af7ee8b8d048d78.zip
git-835d6a1f9f6f0f6e47cf32238af7ee8b8d048d78.tar.gz
git-835d6a1f9f6f0f6e47cf32238af7ee8b8d048d78.tar.bz2
stash drops the stash even if creating the branch fails because it already exists
This bug was disovered by someone on IRC when he tried to $ git stash branch <branch> <stash> while <branch> already existed. In that case the stash is dropped even though it isn't applied on any branch, so the stash is effectively lost. Signed-off-by: Tomas Carnecky <tom@dbservice.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
-rwxr-xr-xt/t3903-stash.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 9ed2396..4215cc6 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -545,4 +545,15 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
git stash drop
'
+test_expect_failure 'stash branch should not drop the stash if the branch exists' '
+ git stash clear &&
+ echo foo >file &&
+ git add file &&
+ git commit -m initial &&
+ echo bar >file &&
+ git stash &&
+ test_must_fail git stash branch master stash@{0} &&
+ git rev-parse stash@{0} --
+'
+
test_done