{"thread":{"id":"24784","subject":"[PATCH v5 4/8] detached-stash: refactor git stash pop implementation","startedAt":"2010-08-18T13:48:49Z","lastAt":"2010-08-19T19:57:59Z","messageCount":7,"participants":["Jon Seymour","Johannes Sixt"],"isPatch":true,"patchVersion":5,"patchTotal":8},"messages":[{"id":"148378","messageId":"1282139333-5150-1-git-send-email-jon.seymour@gmail.com","threadId":"24784","inReplyTo":null,"subject":"[PATCH v5 4/8] detached-stash: refactor git stash pop implementation","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T13:48:49Z","receivedAt":"2010-08-18T13:48:49Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"git stash pop is abstracted into its own implementation function - pop_stash.\n\nThe behaviour is changed so that git stash pop fails early if the\nthe specified stash reference does not exist or does not refer to\nan extant entry in the reflog of the reference stash.\n\nThis fixes the case where the apply succeeds, but the drop fails.\nPreviously this caused caused git stash pop to exit with a non-zero exit code\nand a dirty tree.\n\nNow, git stash pop fails with a non-zero exit code, but the working\ntree is not modified.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   12 ++++++++----\n 1 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 750f360..ac4c0f6 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -423,6 +423,13 @@ apply_stash () {\n \tfi\n }\n \n+pop_stash() {\n+\tassert_stash_ref \"$@\"\n+\n+\tapply_stash \"$@\" &&\n+\tdrop_stash \"$@\"\n+}\n+\n drop_stash () {\n \tassert_stash_ref \"$@\"\n \n@@ -498,10 +505,7 @@ drop)\n \t;;\n pop)\n \tshift\n-\tif apply_stash \"$@\"\n-\tthen\n-\t\tdrop_stash \"$applied_stash\"\n-\tfi\n+\tpop_stash \"$@\"\n \t;;\n branch)\n \tshift\n-- \n1.7.2.1.95.g4fabf\n"},{"id":"148379","messageId":"1282139333-5150-2-git-send-email-jon.seymour@gmail.com","threadId":"24784","inReplyTo":"1282139333-5150-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v5 5/8] detached-stash: simplify git stash branch","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T13:48:50Z","receivedAt":"2010-08-18T13:48:50Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This patch teaches git stash branch to tolerate stash-like arguments.\n\nIn particular, a stash is only required if an argument isn't specified\nand the stash is only dropped if a stash entry reference was\nspecified or implied.\n\nThe implementation has been simplified by taking advantage of\nassert_stash_like() and the variables established by\nparse_flags_and_rev().\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   17 +++++++----------\n 1 files changed, 7 insertions(+), 10 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex ac4c0f6..ff1edc9 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -441,20 +441,17 @@ drop_stash () {\n }\n \n apply_to_branch () {\n-\thave_stash || die 'Nothing to apply'\n-\n \ttest -n \"$1\" || die 'No branch name specified'\n \tbranch=$1\n+\tshift 1\n \n-\tif test -z \"$2\"\n-\tthen\n-\t\tset x \"$ref_stash@{0}\"\n-\tfi\n-\tstash=$2\n+\tset -- --index \"$@\"\n+\tassert_stash_like \"$@\"\n+\n+\tgit checkout -b $branch $REV^ &&\n+\tapply_stash \"$@\"\n \n-\tgit checkout -b $branch $stash^ &&\n-\tapply_stash --index $stash &&\n-\tdrop_stash $stash\n+\ttest -z \"$IS_STASH_REF\" || drop_stash \"$@\"\n }\n \n PARSE_CACHE='--not-parsed'\n-- \n1.7.2.1.95.g4fabf\n"},{"id":"148380","messageId":"1282139333-5150-3-git-send-email-jon.seymour@gmail.com","threadId":"24784","inReplyTo":"1282139333-5150-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v5 6/8] detached-stash: simplify git stash show","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T13:48:51Z","receivedAt":"2010-08-18T13:48:51Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This commit refactors git stash show to make use of the assert_stash_like function.\n\ngit show now dies if the presented argument is non-stash-like.\n\nPrevious behaviour was to tolerate commits that were not even stash-like.\n\nPreviously, git stash show would accept stash-like arguments, but\nonly if there was a stash on the stack.\n\nNow, git stash accepts stash-like arguments always and only fails\nif no stash-like argument is specified and there is no stash stack.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   14 ++------------\n 1 files changed, 2 insertions(+), 12 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex ff1edc9..7ce818b 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -210,19 +210,9 @@ list_stash () {\n }\n \n show_stash () {\n-\thave_stash || die 'No stash found'\n-\n-\tflags=$(git rev-parse --no-revs --flags \"$@\")\n-\tif test -z \"$flags\"\n-\tthen\n-\t\tflags=--stat\n-\tfi\n-\n-\tw_commit=$(git rev-parse --quiet --verify --default $ref_stash \"$@\") &&\n-\tb_commit=$(git rev-parse --quiet --verify \"$w_commit^\") ||\n-\t\tdie \"'$*' is not a stash\"\n+\tassert_stash_like \"$@\"\n \n-\tgit diff $flags $b_commit $w_commit\n+\tgit diff ${FLAGS:---stat} $b_commit $w_commit\n }\n \n #\n-- \n1.7.2.1.95.g4fabf\n"},{"id":"148381","messageId":"1282139333-5150-4-git-send-email-jon.seymour@gmail.com","threadId":"24784","inReplyTo":"1282139333-5150-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v5 7/8] detached-stash: tests of git stash with stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T13:48:52Z","receivedAt":"2010-08-18T13:48:52Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Adds new tests which check that:\n* git stash branch handles a stash-like argument when there is a stash stack\n* git stash branch handles a stash-like argument when there is not a stash stack\n* git stash show handles a stash-like argument when there is a stash stack\n* git stash show handles a stash-like argument when there is not a stash stack\n* git stash drop fails early if the specified argument is not a stash reference\n* git stash pop fails early if the specified argument is not a stash reference\n* git stash * fails early if the reference supplied is bogus\n* git stash fails early with stash@{n} where n >= length of stash log\n\n| Amended per advice from Johannes Sixt to avoid burying stash create failures.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t3903-stash.sh |  140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 140 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 62e208a..efc7e7f 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -378,4 +378,144 @@ test_expect_failure 'stash file to directory' '\n \ttest foo = \"$(cat file/file)\"\n '\n \n+test_expect_success 'stash branch - no stashes on stack, stash-like argument' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tSTASH_ID=$(git stash create) &&\n+\tgit reset --hard &&\n+\tgit stash branch stash-branch ${STASH_ID} &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n+\ttest $(git ls-files --modified | wc -l) -eq 1\n+'\n+\n+test_expect_success 'stash branch - stashes on stack, stash-like argument' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tgit stash &&\n+\ttest_when_finished \"git stash drop\" &&\n+\techo bar >> file &&\n+\tSTASH_ID=$(git stash create) &&\n+\tgit reset --hard &&\n+\tgit stash branch stash-branch ${STASH_ID} &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n+\ttest $(git ls-files --modified | wc -l) -eq 1\n+'\n+\n+test_expect_success 'stash show - stashes on stack, stash-like argument' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tgit stash &&\n+\ttest_when_finished \"git stash drop\" &&\n+\techo bar >> file &&\n+\tSTASH_ID=$(git stash create) &&\n+\tgit reset --hard &&\n+\tgit stash show ${STASH_ID}\n+'\n+test_expect_success 'stash show - no stashes on stack, stash-like argument' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\techo foo >> file &&\n+\tSTASH_ID=$(git stash create) &&\n+\tgit reset --hard &&\n+\tgit stash show ${STASH_ID}\n+'\n+\n+test_expect_success 'stash drop - fail early if specified stash is not a stash reference' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n+\tgit reset --hard &&\n+\techo foo > file &&\n+\tgit stash &&\n+\techo bar > file &&\n+\tgit stash &&\n+\t! git stash drop $(git rev-parse stash@{0}) &&\n+\tgit stash pop &&\n+\ttest bar = \"$(cat file)\" &&\n+\tgit reset --hard HEAD\n+'\n+\n+test_expect_success 'stash pop - fail early if specified stash is not a stash reference' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n+\tgit reset --hard &&\n+\techo foo > file &&\n+\tgit stash &&\n+\techo bar > file &&\n+\tgit stash &&\n+\t! git stash pop $(git rev-parse stash@{0}) &&\n+\tgit stash pop &&\n+\ttest bar = \"$(cat file)\" &&\n+\tgit reset --hard HEAD\n+'\n+\n+test_expect_success 'stash drop - bad stash ref' '\n+\tgit stash clear &&\n+\techo bar5 > file &&\n+\techo bar6 > file2 &&\n+\tgit add file2 &&\n+\tgit stash &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash drop does-not-exist &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash drop does-not-exist@{0} &&\n+\tgit stash drop\n+'\n+\n+test_expect_success 'stash pop - bad stash ref' '\n+\tgit stash clear &&\n+\techo bar5 > file &&\n+\techo bar6 > file2 &&\n+\tgit add file2 &&\n+\tgit stash &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash pop does-not-exist &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash pop does-not-exist@{0} &&\n+\tgit stash drop\n+'\n+\n+test_expect_success 'stash apply - bad stash ref' '\n+\tgit stash clear &&\n+\techo bar5 > file &&\n+\techo bar6 > file2 &&\n+\tgit add file2 &&\n+\tgit stash &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash apply does-not-exist &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash apply does-not-exist@{0} &&\n+\tgit stash drop\n+'\n+\n+test_expect_success 'stash show - bad stash ref' '\n+\tgit stash clear &&\n+\techo bar5 > file &&\n+\techo bar6 > file2 &&\n+\tgit add file2 &&\n+\tgit stash &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash show does-not-exist &&\n+\t! git rev-parse --quiet --verify does-not-exist &&\n+\t! git stash show does-not-exist@{0} &&\n+\tgit stash drop\n+'\n+\n+test_expect_success 'stash drop - invalid stash reference' '\n+\tgit stash clear &&\n+\t! git stash stash@{0} &&\n+\techo bar5 > file &&\n+\techo bar6 > file2 &&\n+\tgit add file2 &&\n+\tgit stash &&\n+\t! git drop stash@{1} &&\n+\tgit stash drop\n+'\n+\n test_done\n-- \n1.7.2.1.95.g4fabf\n"},{"id":"148382","messageId":"1282139333-5150-5-git-send-email-jon.seymour@gmail.com","threadId":"24784","inReplyTo":"1282139333-5150-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v5 8/8] detached-stash: update Documentation","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T13:48:53Z","receivedAt":"2010-08-18T13:48:53Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Update the documentation to indicate that git stash branch only attempts\nto drop the specified stash if it looks like stash reference.\n\nAlso changed the synopsis to more clearly indicate which commands require\na stash entry reference as opposed to merely a stash-like commit.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/git-stash.txt |   16 +++++++++++-----\n 1 files changed, 11 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 473889a..8728f7a 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -104,18 +104,22 @@ tree's changes, but also the index's ones. However, this can fail, when you\n have conflicts (which are stored in the index, where you therefore can no\n longer apply the changes as they were originally).\n +\n-When no `<stash>` is given, `stash@\\{0}` is assumed.\n+When no `<stash>` is given, `stash@\\{0}` is assumed, otherwise `<stash>` must\n+be a reference of the form `stash@\\{<revision>}`.\n \n apply [--index] [-q|--quiet] [<stash>]::\n \n-\tLike `pop`, but do not remove the state from the stash list.\n+\tLike `pop`, but do not remove the state from the stash list. Unlike `pop`,\n+\t`<stash>` may be any commit that looks like a commit created by\n+\t`stash save` or `stash create`.\n \n branch <branchname> [<stash>]::\n \n \tCreates and checks out a new branch named `<branchname>` starting from\n \tthe commit at which the `<stash>` was originally created, applies the\n-\tchanges recorded in `<stash>` to the new working tree and index, then\n-\tdrops the `<stash>` if that completes successfully. When no `<stash>`\n+\tchanges recorded in `<stash>` to the new working tree and index.\n+\tIf that succeeds, and `<stash>` is a reference of the form\n+\t`stash@{<revision>}`, it then drops the `<stash>`. When no `<stash>`\n \tis given, applies the latest one.\n +\n This is useful if the branch on which you ran `git stash save` has\n@@ -132,7 +136,9 @@ clear::\n drop [-q|--quiet] [<stash>]::\n \n \tRemove a single stashed state from the stash list. When no `<stash>`\n-\tis given, it removes the latest one. i.e. `stash@\\{0}`\n+\tis given, it removes the latest one. i.e. `stash@\\{0}`, otherwise\n+\t`<stash>` must a valid stash log reference of the form\n+\t`stash@\\{<revision>}`.\n \n create::\n \n-- \n1.7.2.1.95.g4fabf\n"},{"id":"148421","messageId":"AANLkTi=tuX9CPagi=j9gMt9Kr3P0G4Mpb+43w+NPbfvu@mail.gmail.com","threadId":"24784","inReplyTo":"1282139333-5150-4-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v5 7/8] detached-stash: tests of git stash with stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-18T23:04:45Z","receivedAt":"2010-08-18T23:04:45Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"I'll need to re-issue this patch. The later tests execute\n'successfully', but don't properly implement the intent. In\nparticular, the condition:\n\n! git stash stash@{0}\n\nshould really be:\n\n! git stash drop stash@{0}.\n\nWill re-roll a version 6, perhaps with a variant of Junio's git\nrev-parse tweak...\n\njon.\n\nOn Wed, Aug 18, 2010 at 11:48 PM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> Adds new tests which check that:\n> * git stash branch handles a stash-like argument when there is a stash stack\n> * git stash branch handles a stash-like argument when there is not a stash stack\n> * git stash show handles a stash-like argument when there is a stash stack\n> * git stash show handles a stash-like argument when there is not a stash stack\n> * git stash drop fails early if the specified argument is not a stash reference\n> * git stash pop fails early if the specified argument is not a stash reference\n> * git stash * fails early if the reference supplied is bogus\n> * git stash fails early with stash@{n} where n >= length of stash log\n>\n> | Amended per advice from Johannes Sixt to avoid burying stash create failures.\n>\n> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  t/t3903-stash.sh |  140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 files changed, 140 insertions(+), 0 deletions(-)\n>\n> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> index 62e208a..efc7e7f 100755\n> --- a/t/t3903-stash.sh\n> +++ b/t/t3903-stash.sh\n> @@ -378,4 +378,144 @@ test_expect_failure 'stash file to directory' '\n>        test foo = \"$(cat file/file)\"\n>  '\n>\n> +test_expect_success 'stash branch - no stashes on stack, stash-like argument' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD\" &&\n> +       git reset --hard &&\n> +       echo foo >> file &&\n> +       STASH_ID=$(git stash create) &&\n> +       git reset --hard &&\n> +       git stash branch stash-branch ${STASH_ID} &&\n> +       test_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n> +       test $(git ls-files --modified | wc -l) -eq 1\n> +'\n> +\n> +test_expect_success 'stash branch - stashes on stack, stash-like argument' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD\" &&\n> +       git reset --hard &&\n> +       echo foo >> file &&\n> +       git stash &&\n> +       test_when_finished \"git stash drop\" &&\n> +       echo bar >> file &&\n> +       STASH_ID=$(git stash create) &&\n> +       git reset --hard &&\n> +       git stash branch stash-branch ${STASH_ID} &&\n> +       test_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n> +       test $(git ls-files --modified | wc -l) -eq 1\n> +'\n> +\n> +test_expect_success 'stash show - stashes on stack, stash-like argument' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD\" &&\n> +       git reset --hard &&\n> +       echo foo >> file &&\n> +       git stash &&\n> +       test_when_finished \"git stash drop\" &&\n> +       echo bar >> file &&\n> +       STASH_ID=$(git stash create) &&\n> +       git reset --hard &&\n> +       git stash show ${STASH_ID}\n> +'\n> +test_expect_success 'stash show - no stashes on stack, stash-like argument' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD\" &&\n> +       git reset --hard &&\n> +       echo foo >> file &&\n> +       STASH_ID=$(git stash create) &&\n> +       git reset --hard &&\n> +       git stash show ${STASH_ID}\n> +'\n> +\n> +test_expect_success 'stash drop - fail early if specified stash is not a stash reference' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD && git stash clear\" &&\n> +       git reset --hard &&\n> +       echo foo > file &&\n> +       git stash &&\n> +       echo bar > file &&\n> +       git stash &&\n> +       ! git stash drop $(git rev-parse stash@{0}) &&\n> +       git stash pop &&\n> +       test bar = \"$(cat file)\" &&\n> +       git reset --hard HEAD\n> +'\n> +\n> +test_expect_success 'stash pop - fail early if specified stash is not a stash reference' '\n> +       git stash clear &&\n> +       test_when_finished \"git reset --hard HEAD && git stash clear\" &&\n> +       git reset --hard &&\n> +       echo foo > file &&\n> +       git stash &&\n> +       echo bar > file &&\n> +       git stash &&\n> +       ! git stash pop $(git rev-parse stash@{0}) &&\n> +       git stash pop &&\n> +       test bar = \"$(cat file)\" &&\n> +       git reset --hard HEAD\n> +'\n> +\n> +test_expect_success 'stash drop - bad stash ref' '\n> +       git stash clear &&\n> +       echo bar5 > file &&\n> +       echo bar6 > file2 &&\n> +       git add file2 &&\n> +       git stash &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash drop does-not-exist &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash drop does-not-exist@{0} &&\n> +       git stash drop\n> +'\n> +\n> +test_expect_success 'stash pop - bad stash ref' '\n> +       git stash clear &&\n> +       echo bar5 > file &&\n> +       echo bar6 > file2 &&\n> +       git add file2 &&\n> +       git stash &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash pop does-not-exist &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash pop does-not-exist@{0} &&\n> +       git stash drop\n> +'\n> +\n> +test_expect_success 'stash apply - bad stash ref' '\n> +       git stash clear &&\n> +       echo bar5 > file &&\n> +       echo bar6 > file2 &&\n> +       git add file2 &&\n> +       git stash &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash apply does-not-exist &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash apply does-not-exist@{0} &&\n> +       git stash drop\n> +'\n> +\n> +test_expect_success 'stash show - bad stash ref' '\n> +       git stash clear &&\n> +       echo bar5 > file &&\n> +       echo bar6 > file2 &&\n> +       git add file2 &&\n> +       git stash &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash show does-not-exist &&\n> +       ! git rev-parse --quiet --verify does-not-exist &&\n> +       ! git stash show does-not-exist@{0} &&\n> +       git stash drop\n> +'\n> +\n> +test_expect_success 'stash drop - invalid stash reference' '\n> +       git stash clear &&\n> +       ! git stash stash@{0} &&\n> +       echo bar5 > file &&\n> +       echo bar6 > file2 &&\n> +       git add file2 &&\n> +       git stash &&\n> +       ! git drop stash@{1} &&\n> +       git stash drop\n> +'\n> +\n>  test_done\n> --\n> 1.7.2.1.95.g4fabf\n>\n>\n"},{"id":"148480","messageId":"201008192157.59773.j6t@kdbg.org","threadId":"24784","inReplyTo":"AANLkTi=tuX9CPagi=j9gMt9Kr3P0G4Mpb+43w+NPbfvu@mail.gmail.com","subject":"Re: [PATCH v5 7/8] detached-stash: tests of git stash with stash-like arguments","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-08-19T19:57:59Z","receivedAt":"2010-08-19T19:57:59Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Donnerstag, 19. August 2010, Jon Seymour wrote:\n> I'll need to re-issue this patch. The later tests execute\n> 'successfully', but don't properly implement the intent. In\n> particular, the condition:\n>\n> ! git stash stash@{0}\n>\n> should really be:\n>\n> ! git stash drop stash@{0}.\n\nBetter write this as\n\n  test_must_fail git stash drop stash@{0}\n\n-- Hannes\n"}]}