From 4e9bf3dd6daec09b9a0b110825093c6a480f92e4 Mon Sep 17 00:00:00 2001 From: Joel Teichroeb Date: Sat, 19 Aug 2017 13:13:26 -0700 Subject: 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 Signed-off-by: Junio C Hamano 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 -- stashes and restores the file' ' >foo && >bar && -- cgit v0.10.2-6-g49f6