summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorJoel Teichroeb <joel@teichroeb.net>2017-08-19 20:13:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-19 21:04:04 (GMT)
commit4e9bf3dd6daec09b9a0b110825093c6a480f92e4 (patch)
tree1662ee877f13dc378cb033b03ba1299686048f3f /t/t3903-stash.sh
parentb04e6915fa047bb3103e5be83953f2ca0b4b115b (diff)
downloadgit-4e9bf3dd6daec09b9a0b110825093c6a480f92e4.zip
git-4e9bf3dd6daec09b9a0b110825093c6a480f92e4.tar.gz
git-4e9bf3dd6daec09b9a0b110825093c6a480f92e4.tar.bz2
stash: add a test for stashing in a detached state
All that we are really testing here is that the message is correct when we are not on any branch. All other functionality is already tested elsewhere. 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.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 887010c..3b1ac19 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -822,6 +822,18 @@ test_expect_success 'create with multiple arguments for the message' '
test_cmp expect actual
'
+test_expect_success 'create in a detached state' '
+ test_when_finished "git checkout master" &&
+ git checkout HEAD~1 &&
+ >foo &&
+ git add foo &&
+ STASH_ID=$(git stash create) &&
+ HEAD_ID=$(git rev-parse --short HEAD) &&
+ echo "WIP on (no branch): ${HEAD_ID} initial" >expect &&
+ git show --pretty=%s -s ${STASH_ID} >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'stash -- <pathspec> stashes and restores the file' '
>foo &&
>bar &&