{"thread":{"id":"24610","subject":"[PATCH] stash: It looks like a stash, but doesn't quack like a stash...","startedAt":"2010-08-03T00:59:39Z","lastAt":"2010-08-03T00:59:39Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"147017","messageId":"1280797179-14161-1-git-send-email-jon.seymour@gmail.com","threadId":"24610","inReplyTo":null,"subject":"[PATCH] stash: It looks like a stash, but doesn't quack like a stash...","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-03T00:59:39Z","receivedAt":"2010-08-03T00:59:39Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"In particular, a stash created with git stash create cannot be used as\nan argument to git stash branch because of two separate reasons.\n\n1. a pre-condition assumes that there is always a stash on the stack when git stash branch is called,\nwhich is not necessarily true\n\n2. the cleanup code assumes the specified stash is a stash reference, rather than an arbitrary commit.\n\nThe tests test_expect_failure tests in this patch demonstrate these issues.\n---\n t/t3903-stash.sh |   28 ++++++++++++++++++++++++++++\n 1 files changed, 28 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 62e208a..7fea2a2 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -378,4 +378,32 @@ test_expect_failure 'stash file to directory' '\n \ttest foo = \"$(cat file/file)\"\n '\n \n+test_expect_failure 'stash branch from arbitrary stash ref when there are no stash references' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tgit tag stash-tag $(git stash create) &&\n+\ttest_when_finished \"git tag -d stash-tag\" &&\n+\tgit reset --hard &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master\" &&\n+\tgit stash branch stash-branch $(git rev-parse stash-tag) &&\n+\ttest $(git ls-files --modified) -eq 1\n+'\n+\n+test_expect_failure 'stash branch from arbitrary stash ref fails even if there is a stash' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tgit stash &&\n+\techo bar >> file &&\n+\tgit tag stash-tag $(git stash create) &&\n+\ttest_when_finished \"git tag -d stash-tag\" &&\n+\tgit reset --hard &&\n+\tgit stash branch stash-branch $(git rev-parse stash-tag) &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n+\ttest $(git ls-files --modified) -eq 1\n+'\n+\n test_done\n-- \n1.7.2\n"}]}