mirror of
https://github.com/git/git
synced 2024-09-13 21:34:42 +00:00
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>
This commit is contained in:
parent
b04e6915fa
commit
4e9bf3dd6d
|
@ -822,6 +822,18 @@ test_expect_success 'create with multiple arguments for the message' '
|
||||||
test_cmp expect actual
|
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' '
|
test_expect_success 'stash -- <pathspec> stashes and restores the file' '
|
||||||
>foo &&
|
>foo &&
|
||||||
>bar &&
|
>bar &&
|
||||||
|
|
Loading…
Reference in a new issue