{"thread":{"id":"24665","subject":"[PATCH v3 0/9] stash: modifiy handling of stash-like references","startedAt":"2010-08-08T04:46:02Z","lastAt":"2010-08-14T00:30:25Z","messageCount":30,"participants":["Jon Seymour","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":9},"messages":[{"id":"147416","messageId":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":null,"subject":"[PATCH v3 0/9] stash: modifiy handling of stash-like references","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:02Z","receivedAt":"2010-08-08T04:46:02Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This series teaches git stash branch and git stash show to be more tolerant of \nstash-like references that are not actually stash entry references, while \nteaching git stash pop and git stash drop to be less tolerant of stash-like \nreferences that are not actually stash entry references.\n\nJunio: I did not adopt your suggestion to make git stash drop more tolerant\nof invalid stash references since failing early might help a user\nto spot an incorrect assumption about the state of their working tree\nand stash stack - silently handling this case might hide such an incorrect\nassumption. However, if you would prefer git stash drop to behave that\nway, I'll rework the series accordingly.\n\nThe first 4 commits refactor the existing code without significantly \nchanging existing behaviour.\n\nThe next 4 commits modify existing behaviour to be more (or less) tolerant \nof stash-like references, as required.\n\nThe last 2 commits update the tests and documentation to reflect the modified behaviour.\n\nJon Seymour (9):\n  stash: refactor - create pop_stash function\n  stash: extract stash-like check into its own function\n  stash: introduce is_stash_ref and assert_stash_ref functions.\n  stash: teach git stash pop to fail early if the argument is not a\n    stash ref\n  stash: teach git stash drop to fail early if the specified revision\n    is not a stash reference\n  stash: teach git stash branch to tolerate stash-like arguments\n  stash: teach git stash show to always tolerate stash-like arguments.\n  t3903-stash.sh: tests of git stash with stash-like arguments\n  Documentation: git stash branch now tolerates non-stash references.\n\n Documentation/git-stash.txt |    4 +-\n git-stash.sh                |   92 +++++++++++++++++++++++++++++++------------\n t/t3903-stash.sh            |   81 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 149 insertions(+), 28 deletions(-)\n\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147417","messageId":"1281242771-24764-2-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 1/9] stash: refactor - create pop_stash function","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:03Z","receivedAt":"2010-08-08T04:46:03Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"We plan to edit pop_stash later, so let's make it a first class\ncommand by giving its own implementation function.\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 1d95447..31ea333 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -323,6 +323,13 @@ apply_stash () {\n \tfi\n }\n \n+pop_stash() {\n+\tif apply_stash \"$@\"\n+\tthen\n+\t\tdrop_stash \"$applied_stash\"\n+\tfi\n+}\n+\n drop_stash () {\n \thave_stash || die 'No stash entries to drop'\n \n@@ -422,10 +429,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.51.g82c0c0\n"},{"id":"147418","messageId":"1281242771-24764-3-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 2/9] stash: extract stash-like check into its own function","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:04Z","receivedAt":"2010-08-08T04:46:04Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"A similar code block is used in three places; this change\nfactors the stash-like check into a separate function so that\nit can be used in these and other places.\n\nNote to reviewers: The existing code in apply_stash appears\nto assume w_tree, b_tree and i_tree are all trees as opposed\nto tree-ish (which is what they actually are).\n\nThis refactoring does not change the existing derivation,\nbut one wonders whether this difference might be subverting\nthe intent of the test which compares c_tree with i_tree.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   46 ++++++++++++++++++++++++++++++----------------\n 1 files changed, 30 insertions(+), 16 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 31ea333..dbb7944 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -218,13 +218,30 @@ show_stash () {\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 }\n \n+#\n+# if this function returns, then:\n+#   s is set to the stash commit\n+#   w_commit is set to the commit containing the working tree\n+#   b_commit is set to the base commit\n+#   i_commit is set to the commit containing the index tree\n+# otherwise:\n+#   the function exits via die\n+#\n+assert_stash_like() {\n+\t# stash records the work tree, and is a merge between the\n+\t# base commit (first parent) and the index tree (second parent).\n+\ts=$(git rev-parse --revs-only --quiet --verify --default $ref_stash \"$@\") &&\n+\tw_commit=$(git rev-parse --quiet --verify \"$s:\") &&\n+\tb_commit=$(git rev-parse --quiet --verify \"$s^1:\") &&\n+\ti_commit=$(git rev-parse --quiet --verify \"$s^2:\") ||\n+\t\tdie \"$*: no valid stashed state found\"\n+}\n+\n apply_stash () {\n \tapplied_stash=\n \tunstash_index=\n@@ -253,13 +270,11 @@ apply_stash () {\n \t\tapplied_stash=\"$*\"\n \tfi\n \n-\t# stash records the work tree, and is a merge between the\n-\t# base commit (first parent) and the index tree (second parent).\n-\ts=$(git rev-parse --quiet --verify --default $ref_stash \"$@\") &&\n-\tw_tree=$(git rev-parse --quiet --verify \"$s:\") &&\n-\tb_tree=$(git rev-parse --quiet --verify \"$s^1:\") &&\n-\ti_tree=$(git rev-parse --quiet --verify \"$s^2:\") ||\n-\t\tdie \"$*: no valid stashed state found\"\n+\tassert_stash_like \"$@\"\n+\n+\tb_tree=$b_commit\n+\tw_tree=$w_commit\n+\ti_tree=$i_commit\n \n \tgit update-index -q --refresh &&\n \tgit diff-files --quiet --ignore-submodules ||\n@@ -270,6 +285,9 @@ apply_stash () {\n \t\tdie 'Cannot apply a stash in the middle of a merge'\n \n \tunstashed_index_tree=\n+\t#\n+\t# note to reviewers: comparing $c_tree to $i_tree seems unsound, since i_tree is only tree-ish\n+\t#\n \tif test -n \"$unstash_index\" && test \"$b_tree\" != \"$i_tree\" &&\n \t\t\ttest \"$c_tree\" != \"$i_tree\"\n \tthen\n@@ -351,12 +369,8 @@ drop_stash () {\n \t\tset x \"$ref_stash@{0}\"\n \t\tshift\n \tfi\n-\t# Verify supplied argument looks like a stash entry\n-\ts=$(git rev-parse --verify \"$@\") &&\n-\tgit rev-parse --verify \"$s:\"   > /dev/null 2>&1 &&\n-\tgit rev-parse --verify \"$s^1:\" > /dev/null 2>&1 &&\n-\tgit rev-parse --verify \"$s^2:\" > /dev/null 2>&1 ||\n-\t\tdie \"$*: not a valid stashed state\"\n+\n+\tassert_stash_like \"$@\"\n \n \tgit reflog delete --updateref --rewrite \"$@\" &&\n \t\tsay \"Dropped $* ($s)\" || die \"$*: Could not drop stash entry\"\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147425","messageId":"1281242771-24764-4-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 3/9] stash: introduce is_stash_ref and assert_stash_ref functions.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:05Z","receivedAt":"2010-08-08T04:46:05Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Introduce a function, is_stash_ref, which checks whether an\nargument is valid stash reference (e.g. is of the form ['refs/']stash['@{'something'}])\n\nIntroduce a function, assert_stash_ref, which can be used to ensure\nthat certain commands are only called with stash references as\narguments.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex dbb7944..41a9359 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -223,6 +223,15 @@ show_stash () {\n \tgit diff $flags $b_commit $w_commit\n }\n \n+is_stash_ref() {\n+\trevs=\"$(git rev-parse --revs-only --symbolic --verify --default ${ref_stash} \"$@\")\" &&\n+\ttest \"$ref_stash\" = \"$(git rev-parse --symbolic-full-name \"${revs%@*}\")\"\n+}\n+\n+assert_stash_ref() {\n+\tis_stash_ref \"$@\" || die \"$* is not a stash reference\"\n+}\n+\n #\n # if this function returns, then:\n #   s is set to the stash commit\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147419","messageId":"1281242771-24764-5-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 4/9] stash: teach git stash pop to fail early if the argument is not a stash ref","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:06Z","receivedAt":"2010-08-08T04:46:06Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"With this change, git stash pop will fail early if a specified\nrevision argument is not a valid stash reference.\n\nThis fixes the case where the apply succeeds, but the drop fails which\ncaused git stash pop to exit with a non-zero exit code and a dirty tree.\n\nNow, git stash pop fails with a non-zero exit code, but the tree is not\nmodified.\n\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 41a9359..4f28c09 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -351,10 +351,10 @@ apply_stash () {\n }\n \n pop_stash() {\n-\tif apply_stash \"$@\"\n-\tthen\n-\t\tdrop_stash \"$applied_stash\"\n-\tfi\n+\tassert_stash_ref \"$@\"\n+\n+\tapply_stash \"$@\" &&\n+\tdrop_stash \"$applied_stash\"\n }\n \n drop_stash () {\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147420","messageId":"1281242771-24764-6-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 5/9] stash: teach git stash drop to fail early if the specified revision is not a stash reference","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:07Z","receivedAt":"2010-08-08T04:46:07Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Previously, git stash drop would fail noisily while executing git reflog\ndelete if the specified revision argument was not a stash reference.\n\nNow, git stash drop fails with an error message which more precisely\nindicates the reason for failure.\n\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 4f28c09..86cd446 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -379,6 +379,7 @@ drop_stash () {\n \t\tshift\n \tfi\n \n+\tassert_stash_ref \"$@\"\n \tassert_stash_like \"$@\"\n \n \tgit reflog delete --updateref --rewrite \"$@\" &&\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147422","messageId":"1281242771-24764-7-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 6/9] stash: teach git stash branch to tolerate stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:08Z","receivedAt":"2010-08-08T04:46:08Z","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\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   15 +++++++++++----\n 1 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 86cd446..97e3749 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -390,20 +390,27 @@ 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 \n \tif test -z \"$2\"\n \tthen\n \t\tset x \"$ref_stash@{0}\"\n+\t\thave_stash || die 'Nothing to apply'\n \tfi\n \tstash=$2\n \n+\tassert_stash_like \"$stash\"\n+\n \tgit checkout -b $branch $stash^ &&\n-\tapply_stash --index $stash &&\n-\tdrop_stash $stash\n+\tapply_stash --index $stash\n+\n+\tif is_stash_ref \"$stash\"\n+\tthen\n+\t\tdrop_stash \"$stash\"\n+\telse\n+\t\ttrue\n+\tfi\n }\n \n # The default command is \"save\" if nothing but options are given\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147421","messageId":"1281242771-24764-8-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 7/9] stash: teach git stash show to always tolerate stash-like arguments.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:09Z","receivedAt":"2010-08-08T04:46:09Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Previously, 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\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 97e3749..5b875ea 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -210,14 +210,19 @@ 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+\trevs=$(git rev-parse --revs-only \"$@\")\n+\tif test -z \"$revs\"\n+\tthen\n+\t\thave_stash || die \"No stash found\"\n+\t\tset -- ${ref_stash}@{0}\n+\tfi\n+\n \tassert_stash_like \"$@\"\n \n \tgit diff $flags $b_commit $w_commit\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147423","messageId":"1281242771-24764-9-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 8/9] t3903-stash.sh: tests of git stash with stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:10Z","receivedAt":"2010-08-08T04:46:10Z","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\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t3903-stash.sh |   81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 81 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 62e208a..4910409 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -378,4 +378,85 @@ 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+\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 | 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+\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 | 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+\tgit tag stash-tag $(git stash create) &&\n+\ttest_when_finished \"git tag -d stash-tag\" &&\n+\tgit reset --hard &&\n+\tgit stash show stash-tag\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+\tgit tag stash-tag $(git stash create) &&\n+\ttest_when_finished \"git tag -d stash-tag\" &&\n+\tgit reset --hard &&\n+\tgit stash show stash-tag\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_done\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147424","messageId":"1281242771-24764-10-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v3 9/9] Documentation: git stash branch now tolerates non-stash references.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T04:46:11Z","receivedAt":"2010-08-08T04:46:11Z","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\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/git-stash.txt |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 473889a..c7b7e4e 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -115,8 +115,8 @@ branch <branchname> [<stash>]::\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-\tis given, applies the latest one.\n+\tdrops the `<stash>` if that completes successfully and `<stash>` looks like a\n+\tstash the name of a stash list entry. When no `<stash>` is given, applies the latest one.\n +\n This is useful if the branch on which you ran `git stash save` has\n changed enough that `git stash apply` fails due to conflicts. Since\n-- \n1.7.2.1.51.g82c0c0\n"},{"id":"147429","messageId":"201008081132.56998.j6t@kdbg.org","threadId":"24665","inReplyTo":"1281242771-24764-9-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v3 8/9] t3903-stash.sh: tests of git stash with stash-like arguments","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-08-08T09:32:56Z","receivedAt":"2010-08-08T09:32:56Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Sonntag, 8. August 2010, Jon Seymour wrote:\n> +test_expect_success 'stash branch - no stashes on stack, stash-like\n> argument' ' +\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\nTo catch failures in $(git stash create), you should rewrite lines like this \none as:\n\n\tstashid=$(git stash create) &&\n\tgit tag stash-tag $stashid &&\n\n-- Hannes\n"},{"id":"147437","messageId":"AANLkTik8jN_LqB+mOqDAGzFnBo4R0_LDxApshm5iGORa@mail.gmail.com","threadId":"24665","inReplyTo":"201008081132.56998.j6t@kdbg.org","subject":"Re: [PATCH v3 8/9] t3903-stash.sh: tests of git stash with stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T12:56:09Z","receivedAt":"2010-08-08T12:56:09Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Aug 8, 2010 at 7:32 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n> On Sonntag, 8. August 2010, Jon Seymour wrote:\n> To catch failures in $(git stash create), you should rewrite lines like this\n> one as:\n>\n>        stashid=$(git stash create) &&\n>        git tag stash-tag $stashid &&\n>\n\nGood point. I've replaced the use of git tag with a variable\nassignment and dereference and will repost the series with these\nchanges in a day or two.\n\nRegards,\n\njon.\n"},{"id":"147439","messageId":"AANLkTik+E13hg=q5ML_9Y5GT2PygSEQ7YWOwXv3L_HmC@mail.gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-10-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v3 9/9] Documentation: git stash branch now tolerates non-stash references.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-08T13:18:22Z","receivedAt":"2010-08-08T13:18:22Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"The next iteration will amend the synopsis as follows:\n\n-'git stash' show [<stash>]\n-'git stash' drop [-q|--quiet] [<stash>]\n-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n-'git stash' branch <branchname> [<stash>]\n+'git stash' show [<stash-like>]\n+'git stash' drop [-q|--quiet] [<stash-entry>]\n+'git stash' pop [--index] [-q|--quiet] [<stash-entry>]\n+'git stash' apply [--index] [-q|--quiet] [<stash-like>]\n+'git stash' branch <branchname> [<stash-like>]\n\nwith corresponding changes to the body. This will help clarify when a\nstash entry\nis required and when a stash-like commit can be used instead.\n\nOn Sun, Aug 8, 2010 at 2:46 PM, Jon Seymour <jon.seymour@gmail.com> wrote:\n> Update the documentation to indicate that git stash branch only attempts\n> to drop the specified stash if it looks like stash reference.\n>\n> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n> ---\n>  Documentation/git-stash.txt |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\n> index 473889a..c7b7e4e 100644\n> --- a/Documentation/git-stash.txt\n> +++ b/Documentation/git-stash.txt\n> @@ -115,8 +115,8 @@ branch <branchname> [<stash>]::\n>        Creates and checks out a new branch named `<branchname>` starting from\n>        the commit at which the `<stash>` was originally created, applies the\n>        changes recorded in `<stash>` to the new working tree and index, then\n> -       drops the `<stash>` if that completes successfully. When no `<stash>`\n> -       is given, applies the latest one.\n> +       drops the `<stash>` if that completes successfully and `<stash>` looks like a\n> +       stash the name of a stash list entry. When no `<stash>` is given, applies the latest one.\n>  +\n>  This is useful if the branch on which you ran `git stash save` has\n>  changed enough that `git stash apply` fails due to conflicts. Since\n> --\n> 1.7.2.1.51.g82c0c0\n>\n>\n"},{"id":"147589","messageId":"1281398688-21008-1-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 0/9] stash: modifiy handling of stash-like references","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:39Z","receivedAt":"2010-08-10T00:04:39Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This series teaches git stash branch and git stash show to be more tolerant of \nstash-like references that are not actually stash entry references, while \nteaching git stash pop and git stash drop to be less tolerant of stash-like \nreferences that are not actually stash entry references.\n\nJunio: I did not adopt your suggestion to make git stash drop more tolerant\nof invalid stash references since failing early might help a user\nto spot an incorrect assumption about the state of their working tree\nand stash stack - silently handling this case might hide such an incorrect\nassumption. However, if you would prefer git stash drop to behave that\nway, I'll rework the series accordingly.\n\nThe first 3 commits refactor the existing code without significantly \nchanging existing behaviour.\n\nThe next 4 commits modify existing behaviour to be more (or less) tolerant \nof stash-like references, as required.\n\nThe last 2 commits update the tests and documentation to reflect the modified behaviour.\n\nThanks to Johannes Sixt for suggesting improvements to the tests.\n\nThis series in unchanged from v3 except for patch 8 which improves the tests and\npatch 9 which enhances the documentation to indicate which commands require\na stash entry reference and which are happy to use just a stash-like\ncommit.\n\nJon Seymour (9):\n  stash: refactor - create pop_stash function\n  stash: extract stash-like check into its own function\n  stash: introduce is_stash_ref and assert_stash_ref functions.\n  stash: teach git stash pop to fail early if the argument is not a\n    stash ref\n  stash: teach git stash drop to fail early if the specified revision\n    is not a stash reference\n  stash: teach git stash branch to tolerate stash-like arguments\n  stash: teach git stash show to always tolerate stash-like arguments.\n  t3903-stash.sh: tests of git stash with stash-like arguments\n  Documentation: git stash branch now tolerates non-stash references.\n\n Documentation/git-stash.txt |   37 +++++++++--------\n git-stash.sh                |   92 +++++++++++++++++++++++++++++++------------\n t/t3903-stash.sh            |   77 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 163 insertions(+), 43 deletions(-)\n"},{"id":"147590","messageId":"1281398688-21008-2-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 1/9] stash: refactor - create pop_stash function","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:40Z","receivedAt":"2010-08-10T00:04:40Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"We plan to edit pop_stash later, so let's make it a first class\ncommand by giving its own implementation function.\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 1d95447..31ea333 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -323,6 +323,13 @@ apply_stash () {\n \tfi\n }\n \n+pop_stash() {\n+\tif apply_stash \"$@\"\n+\tthen\n+\t\tdrop_stash \"$applied_stash\"\n+\tfi\n+}\n+\n drop_stash () {\n \thave_stash || die 'No stash entries to drop'\n \n@@ -422,10 +429,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.6.5.rc3.8.g8ba5e\n"},{"id":"147591","messageId":"1281398688-21008-3-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 2/9] stash: extract stash-like check into its own function","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:41Z","receivedAt":"2010-08-10T00:04:41Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"A similar code block is used in three places; this change\nfactors the stash-like check into a separate function so that\nit can be used in these and other places.\n\nNote to reviewers: The existing code in apply_stash appears\nto assume w_tree, b_tree and i_tree are all trees as opposed\nto tree-ish (which is what they actually are).\n\nThis refactoring does not change the existing derivation,\nbut one wonders whether this difference might be subverting\nthe intent of the test which compares c_tree with i_tree.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   46 ++++++++++++++++++++++++++++++----------------\n 1 files changed, 30 insertions(+), 16 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 31ea333..dbb7944 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -218,13 +218,30 @@ show_stash () {\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 }\n \n+#\n+# if this function returns, then:\n+#   s is set to the stash commit\n+#   w_commit is set to the commit containing the working tree\n+#   b_commit is set to the base commit\n+#   i_commit is set to the commit containing the index tree\n+# otherwise:\n+#   the function exits via die\n+#\n+assert_stash_like() {\n+\t# stash records the work tree, and is a merge between the\n+\t# base commit (first parent) and the index tree (second parent).\n+\ts=$(git rev-parse --revs-only --quiet --verify --default $ref_stash \"$@\") &&\n+\tw_commit=$(git rev-parse --quiet --verify \"$s:\") &&\n+\tb_commit=$(git rev-parse --quiet --verify \"$s^1:\") &&\n+\ti_commit=$(git rev-parse --quiet --verify \"$s^2:\") ||\n+\t\tdie \"$*: no valid stashed state found\"\n+}\n+\n apply_stash () {\n \tapplied_stash=\n \tunstash_index=\n@@ -253,13 +270,11 @@ apply_stash () {\n \t\tapplied_stash=\"$*\"\n \tfi\n \n-\t# stash records the work tree, and is a merge between the\n-\t# base commit (first parent) and the index tree (second parent).\n-\ts=$(git rev-parse --quiet --verify --default $ref_stash \"$@\") &&\n-\tw_tree=$(git rev-parse --quiet --verify \"$s:\") &&\n-\tb_tree=$(git rev-parse --quiet --verify \"$s^1:\") &&\n-\ti_tree=$(git rev-parse --quiet --verify \"$s^2:\") ||\n-\t\tdie \"$*: no valid stashed state found\"\n+\tassert_stash_like \"$@\"\n+\n+\tb_tree=$b_commit\n+\tw_tree=$w_commit\n+\ti_tree=$i_commit\n \n \tgit update-index -q --refresh &&\n \tgit diff-files --quiet --ignore-submodules ||\n@@ -270,6 +285,9 @@ apply_stash () {\n \t\tdie 'Cannot apply a stash in the middle of a merge'\n \n \tunstashed_index_tree=\n+\t#\n+\t# note to reviewers: comparing $c_tree to $i_tree seems unsound, since i_tree is only tree-ish\n+\t#\n \tif test -n \"$unstash_index\" && test \"$b_tree\" != \"$i_tree\" &&\n \t\t\ttest \"$c_tree\" != \"$i_tree\"\n \tthen\n@@ -351,12 +369,8 @@ drop_stash () {\n \t\tset x \"$ref_stash@{0}\"\n \t\tshift\n \tfi\n-\t# Verify supplied argument looks like a stash entry\n-\ts=$(git rev-parse --verify \"$@\") &&\n-\tgit rev-parse --verify \"$s:\"   > /dev/null 2>&1 &&\n-\tgit rev-parse --verify \"$s^1:\" > /dev/null 2>&1 &&\n-\tgit rev-parse --verify \"$s^2:\" > /dev/null 2>&1 ||\n-\t\tdie \"$*: not a valid stashed state\"\n+\n+\tassert_stash_like \"$@\"\n \n \tgit reflog delete --updateref --rewrite \"$@\" &&\n \t\tsay \"Dropped $* ($s)\" || die \"$*: Could not drop stash entry\"\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147592","messageId":"1281398688-21008-4-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 3/9] stash: introduce is_stash_ref and assert_stash_ref functions.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:42Z","receivedAt":"2010-08-10T00:04:42Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Introduce a function, is_stash_ref, which checks whether an\nargument is valid stash reference (e.g. is of the form ['refs/']stash['@{'something'}])\n\nIntroduce a function, assert_stash_ref, which can be used to ensure\nthat certain commands are only called with stash references as\narguments.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex dbb7944..41a9359 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -223,6 +223,15 @@ show_stash () {\n \tgit diff $flags $b_commit $w_commit\n }\n \n+is_stash_ref() {\n+\trevs=\"$(git rev-parse --revs-only --symbolic --verify --default ${ref_stash} \"$@\")\" &&\n+\ttest \"$ref_stash\" = \"$(git rev-parse --symbolic-full-name \"${revs%@*}\")\"\n+}\n+\n+assert_stash_ref() {\n+\tis_stash_ref \"$@\" || die \"$* is not a stash reference\"\n+}\n+\n #\n # if this function returns, then:\n #   s is set to the stash commit\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147596","messageId":"1281398688-21008-5-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 4/9] stash: teach git stash pop to fail early if the argument is not a stash ref","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:43Z","receivedAt":"2010-08-10T00:04:43Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"With this change, git stash pop will fail early if a specified\nrevision argument is not a valid stash reference.\n\nThis fixes the case where the apply succeeds, but the drop fails which\ncaused git stash pop to exit with a non-zero exit code and a dirty tree.\n\nNow, git stash pop fails with a non-zero exit code, but the tree is not\nmodified.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 41a9359..4f28c09 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -351,10 +351,10 @@ apply_stash () {\n }\n \n pop_stash() {\n-\tif apply_stash \"$@\"\n-\tthen\n-\t\tdrop_stash \"$applied_stash\"\n-\tfi\n+\tassert_stash_ref \"$@\"\n+\n+\tapply_stash \"$@\" &&\n+\tdrop_stash \"$applied_stash\"\n }\n \n drop_stash () {\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147597","messageId":"1281398688-21008-6-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 5/9] stash: teach git stash drop to fail early if the specified revision is not a stash reference","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:44Z","receivedAt":"2010-08-10T00:04:44Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Previously, git stash drop would fail noisily while executing git reflog\ndelete if the specified revision argument was not a stash reference.\n\nNow, git stash drop fails with an error message which more precisely\nindicates the reason for failure.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 4f28c09..86cd446 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -379,6 +379,7 @@ drop_stash () {\n \t\tshift\n \tfi\n \n+\tassert_stash_ref \"$@\"\n \tassert_stash_like \"$@\"\n \n \tgit reflog delete --updateref --rewrite \"$@\" &&\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147595","messageId":"1281398688-21008-7-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 6/9] stash: teach git stash branch to tolerate stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:45Z","receivedAt":"2010-08-10T00:04:45Z","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\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-stash.sh |   15 +++++++++++----\n 1 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 86cd446..97e3749 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -390,20 +390,27 @@ 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 \n \tif test -z \"$2\"\n \tthen\n \t\tset x \"$ref_stash@{0}\"\n+\t\thave_stash || die 'Nothing to apply'\n \tfi\n \tstash=$2\n \n+\tassert_stash_like \"$stash\"\n+\n \tgit checkout -b $branch $stash^ &&\n-\tapply_stash --index $stash &&\n-\tdrop_stash $stash\n+\tapply_stash --index $stash\n+\n+\tif is_stash_ref \"$stash\"\n+\tthen\n+\t\tdrop_stash \"$stash\"\n+\telse\n+\t\ttrue\n+\tfi\n }\n \n # The default command is \"save\" if nothing but options are given\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147594","messageId":"1281398688-21008-8-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 7/9] stash: teach git stash show to always tolerate stash-like arguments.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:46Z","receivedAt":"2010-08-10T00:04:46Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Previously, 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 |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 97e3749..5b875ea 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -210,14 +210,19 @@ 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+\trevs=$(git rev-parse --revs-only \"$@\")\n+\tif test -z \"$revs\"\n+\tthen\n+\t\thave_stash || die \"No stash found\"\n+\t\tset -- ${ref_stash}@{0}\n+\tfi\n+\n \tassert_stash_like \"$@\"\n \n \tgit diff $flags $b_commit $w_commit\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147593","messageId":"1281398688-21008-9-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 8/9] t3903-stash.sh: tests of git stash with stash-like arguments","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:47Z","receivedAt":"2010-08-10T00:04:47Z","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\n| Amended per advice from Johannes Sixt to avoid burying stash create failures.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n t/t3903-stash.sh |   77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 77 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 62e208a..c051b51 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -378,4 +378,81 @@ 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_done\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147598","messageId":"1281398688-21008-10-git-send-email-jon.seymour@gmail.com","threadId":"24665","inReplyTo":"1281242771-24764-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH v4 9/9] Documentation: git stash branch now tolerates non-stash references.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-10T00:04:48Z","receivedAt":"2010-08-10T00:04:48Z","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 |   37 ++++++++++++++++++++-----------------\n 1 files changed, 20 insertions(+), 17 deletions(-)\n\ndiff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\nindex 473889a..499ac48 100644\n--- a/Documentation/git-stash.txt\n+++ b/Documentation/git-stash.txt\n@@ -9,10 +9,11 @@ SYNOPSIS\n --------\n [verse]\n 'git stash' list [<options>]\n-'git stash' show [<stash>]\n-'git stash' drop [-q|--quiet] [<stash>]\n-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n-'git stash' branch <branchname> [<stash>]\n+'git stash' show [<stash-like>]\n+'git stash' drop [-q|--quiet] [<stash-entry>]\n+'git stash' pop [--index] [-q|--quiet] [<stash-entry>]\n+'git stash' apply [--index] [-q|--quiet] [<stash-like>]\n+'git stash' branch <branchname> [<stash-like>]\n 'git stash' [save [--patch] [-k|--[no-]keep-index] [-q|--quiet] [<message>]]\n 'git stash' clear\n 'git stash' create\n@@ -80,15 +81,15 @@ stash@{1}: On master: 9cc0589... Add git-stash\n The command takes options applicable to the 'git log'\n command to control what is shown and how. See linkgit:git-log[1].\n \n-show [<stash>]::\n+show [<stash-like>]::\n \n \tShow the changes recorded in the stash as a diff between the\n-\tstashed state and its original parent. When no `<stash>` is given,\n+\tstashed state and its original parent. When no `<stash-like>` is given,\n \tshows the latest one. By default, the command shows the diffstat, but\n \tit will accept any format known to 'git diff' (e.g., `git stash show\n \t-p stash@\\{1}` to view the second most recent stash in patch form).\n \n-pop [--index] [-q|--quiet] [<stash>]::\n+pop [--index] [-q|--quiet] [<stash-entry>]::\n \n \tRemove a single stashed state from the stash list and apply it\n \ton top of the current working tree state, i.e., do the inverse\n@@ -104,19 +105,21 @@ 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-entry>` is given, `stash@\\{0}` is assumed.\n \n-apply [--index] [-q|--quiet] [<stash>]::\n+apply [--index] [-q|--quiet] [<stash-like>]::\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+\tthe `<stash-like>` argument can be any commit that looks like a stash, for\n+\texample, a stash created with `create`.\n \n-branch <branchname> [<stash>]::\n+branch <branchname> [<stash-like>]::\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-\tis given, applies the latest one.\n+\tthe commit at which the `<stash-like>` was originally created, applies the\n+\tchanges recorded in `<stash-like>` to the new working tree and index, then\n+\tdrops the `<stash-like>` if that completes successfully and `<stash-like>`\n+\tis also a stash entry. When no `<stash-like>` is given, applies the latest one.\n +\n This is useful if the branch on which you ran `git stash save` has\n changed enough that `git stash apply` fails due to conflicts. Since\n@@ -129,9 +132,9 @@ clear::\n \tbe subject to pruning, and may be impossible to recover (see\n \t'Examples' below for a possible strategy).\n \n-drop [-q|--quiet] [<stash>]::\n+drop [-q|--quiet] [<stash-entry>]::\n \n-\tRemove a single stashed state from the stash list. When no `<stash>`\n+\tRemove a single stashed state from the stash list. When no `<stash-entry>`\n \tis given, it removes the latest one. i.e. `stash@\\{0}`\n \n create::\n-- \n1.6.5.rc3.8.g8ba5e\n"},{"id":"147973","messageId":"7v8w4bnxpj.fsf@alter.siamese.dyndns.org","threadId":"24665","inReplyTo":"1281398688-21008-3-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v4 2/9] stash: extract stash-like check into its own function","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-13T00:49:28Z","receivedAt":"2010-08-13T00:49:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> A similar code block is used in three places; this change\n> factors the stash-like check into a separate function so that\n> it can be used in these and other places.\n\n\"git stash show\" used to be able to show a single-parent commit, and we\nare forbidding that \"feature\".  I'd actually call that a bugfix though ;-)\n\n> +# if this function returns, then:\n> +#   s is set to the stash commit\n> +#   w_commit is set to the commit containing the working tree\n> +#   b_commit is set to the base commit\n> +#   i_commit is set to the commit containing the index tree\n> +# otherwise:\n> +#   the function exits via die\n> +#\n> +assert_stash_like() {\n> +\t# stash records the work tree, and is a merge between the\n> +\t# base commit (first parent) and the index tree (second parent).\n> +\ts=$(git rev-parse --revs-only --quiet --verify --default $ref_stash \"$@\") &&\n> +\tw_commit=$(git rev-parse --quiet --verify \"$s:\") &&\n> +\tb_commit=$(git rev-parse --quiet --verify \"$s^1:\") &&\n> +\ti_commit=$(git rev-parse --quiet --verify \"$s^2:\") ||\n> +\t\tdie \"$*: no valid stashed state found\"\n\nDon't these \"rev-parse\" calls return tree objects?  It is too confusing to\ncall them x_commit if that is the case.\n"},{"id":"147975","messageId":"7v39ujnxpa.fsf@alter.siamese.dyndns.org","threadId":"24665","inReplyTo":"1281398688-21008-4-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v4 3/9] stash: introduce is_stash_ref and assert_stash_ref functions.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-13T00:49:37Z","receivedAt":"2010-08-13T00:49:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> Introduce a function, is_stash_ref, which checks whether an\n> argument is valid stash reference (e.g. is of the form ['refs/']stash['@{'something'}])\n>\n> Introduce a function, assert_stash_ref, which can be used to ensure\n> that certain commands are only called with stash references as\n> arguments.\n>\n> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n> ---\n>  git-stash.sh |    9 +++++++++\n>  1 files changed, 9 insertions(+), 0 deletions(-)\n>\n> diff --git a/git-stash.sh b/git-stash.sh\n> index dbb7944..41a9359 100755\n> --- a/git-stash.sh\n> +++ b/git-stash.sh\n> @@ -223,6 +223,15 @@ show_stash () {\n>  \tgit diff $flags $b_commit $w_commit\n>  }\n>  \n> +is_stash_ref() {\n> +\trevs=\"$(git rev-parse --revs-only --symbolic --verify --default ${ref_stash} \"$@\")\" &&\n> +\ttest \"$ref_stash\" = \"$(git rev-parse --symbolic-full-name \"${revs%@*}\")\"\n> +}\n> +\n> +assert_stash_ref() {\n> +\tis_stash_ref \"$@\" || die \"$* is not a stash reference\"\n> +}\n\nI have to wonder what these functions would do when given more than one\nargs, but I cannot (yet) see the users of this function, which may be\ndoing their own sanity checking to avoid that situation, so...\n"},{"id":"147974","messageId":"7vwrrvmj4n.fsf@alter.siamese.dyndns.org","threadId":"24665","inReplyTo":"1281398688-21008-8-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v4 7/9] stash: teach git stash show to always tolerate stash-like arguments.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-13T00:49:44Z","receivedAt":"2010-08-13T00:49:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> +\trevs=$(git rev-parse --revs-only \"$@\")\n\nYou probably want to also give --no-flags to avoid  \"show stash --parents\"\ngrabbing --parents into $revs variable here.\n"},{"id":"147976","messageId":"7vr5i3mj4h.fsf@alter.siamese.dyndns.org","threadId":"24665","inReplyTo":"1281398688-21008-10-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH v4 9/9] Documentation: git stash branch now tolerates non-stash references.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-13T00:49:50Z","receivedAt":"2010-08-13T00:49:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> Update the documentation to indicate that git stash branch only attempts\n> to drop the specified stash if it looks like stash reference.\n>\n> Also changed the synopsis to more clearly indicate which commands require\n> a stash entry reference as opposed to merely a stash-like commit.\n>\n> Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n> ---\n>  Documentation/git-stash.txt |   37 ++++++++++++++++++++-----------------\n>  1 files changed, 20 insertions(+), 17 deletions(-)\n>\n> diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt\n> index 473889a..499ac48 100644\n> --- a/Documentation/git-stash.txt\n> +++ b/Documentation/git-stash.txt\n> @@ -9,10 +9,11 @@ SYNOPSIS\n>  --------\n>  [verse]\n>  'git stash' list [<options>]\n> -'git stash' show [<stash>]\n> -'git stash' drop [-q|--quiet] [<stash>]\n> -'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]\n> -'git stash' branch <branchname> [<stash>]\n> +'git stash' show [<stash-like>]\n> +'git stash' drop [-q|--quiet] [<stash-entry>]\n> +'git stash' pop [--index] [-q|--quiet] [<stash-entry>]\n> +'git stash' apply [--index] [-q|--quiet] [<stash-like>]\n> +'git stash' branch <branchname> [<stash-like>]\n>  'git stash' [save [--patch] [-k|--[no-]keep-index] [-q|--quiet] [<message>]]\n>  'git stash' clear\n>  'git stash' create\n> @@ -80,15 +81,15 @@ stash@{1}: On master: 9cc0589... Add git-stash\n>  The command takes options applicable to the 'git log'\n>  command to control what is shown and how. See linkgit:git-log[1].\n>  \n> -show [<stash>]::\n> +show [<stash-like>]::\n>  \n>  \tShow the changes recorded in the stash as a diff between the\n> -\tstashed state and its original parent. When no `<stash>` is given,\n> +\tstashed state and its original parent. When no `<stash-like>` is given,\n>  \tshows the latest one. By default, the command shows the diffstat, but\n>  \tit will accept any format known to 'git diff' (e.g., `git stash show\n>  \t-p stash@\\{1}` to view the second most recent stash in patch form).\n\nHmm.\n\nIs there anything that describes how <stash-like>, <stash-entry> and\n<stash> relate to each other?  I do not think a regular reader can answer\nby reading the description after the patch these questions:\n\n - Is a <stash-entry> a <stash-like>?\n - Is the opposite true?\n\netc...\n\nPerhaps we can simply call these two-parent merge commits a <stash>,\ndefine that these commands as working on a <stash>, add notes to certain\nsubcommands that the <stash> they take must be on the stash ref (as\nopposed to a freestanding one you can create with \"stash create\"), and be\ndone with it?\n\nAlso what is the error condition?  I am assuming that your <stash-entry>\nis a <stash-like> that is on the reflog of refs/stash, but if you give a\n<stash-like> that is not a <stash-entry> (iow a freestanding <stash>) to a\nsubcommand that wants to see <stash-entry>, what happens, and does the\ndocument describe it as an error?\n\n> -pop [--index] [-q|--quiet] [<stash>]::\n> +pop [--index] [-q|--quiet] [<stash-entry>]::\n>  \n>  \tRemove a single stashed state from the stash list and apply it\n>  \ton top of the current working tree state, i.e., do the inverse\n"},{"id":"148057","messageId":"AANLkTimDoRHGgQz70P9SZuFQzdUJqPQFY-+3qLvii3gy@mail.gmail.com","threadId":"24665","inReplyTo":"7v8w4bnxpj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 2/9] stash: extract stash-like check into its own function","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-13T23:55:24Z","receivedAt":"2010-08-13T23:55:24Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Fri, Aug 13, 2010 at 10:49 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n>> A similar code block is used in three places; this change\n>> factors the stash-like check into a separate function so that\n>> it can be used in these and other places.\n>\n> \"git stash show\" used to be able to show a single-parent commit, and we\n> are forbidding that \"feature\".  I'd actually call that a bugfix though ;-)\n>\n>> +# if this function returns, then:\n>> +#   s is set to the stash commit\n>> +#   w_commit is set to the commit containing the working tree\n>> +#   b_commit is set to the base commit\n>> +#   i_commit is set to the commit containing the index tree\n>> +# otherwise:\n>> +#   the function exits via die\n>> +#\n>> +assert_stash_like() {\n>> +     # stash records the work tree, and is a merge between the\n>> +     # base commit (first parent) and the index tree (second parent).\n>> +     s=$(git rev-parse --revs-only --quiet --verify --default $ref_stash \"$@\") &&\n>> +     w_commit=$(git rev-parse --quiet --verify \"$s:\") &&\n>> +     b_commit=$(git rev-parse --quiet --verify \"$s^1:\") &&\n>> +     i_commit=$(git rev-parse --quiet --verify \"$s^2:\") ||\n>> +             die \"$*: no valid stashed state found\"\n>\n> Don't these \"rev-parse\" calls return tree objects?  It is too confusing to\n> call them x_commit if that is the case.\n>\n\nMy bad. You are quite correct. I was a little _too_ eager to remove a\nredundancy. This also explains my misconceived \"Note tor reviewers\"!\nI'll fix in the next round.\n"},{"id":"148063","messageId":"AANLkTi=wZSjUvK1SV91xwStb3Pr0u6ytMsaBFN42N2dR@mail.gmail.com","threadId":"24665","inReplyTo":"7v39ujnxpa.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 3/9] stash: introduce is_stash_ref and assert_stash_ref functions.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-14T00:26:36Z","receivedAt":"2010-08-14T00:26:36Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"| Apologies - missed the list in my first reply.\n\n\nOn Fri, Aug 13, 2010 at 10:49 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n> I have to wonder what these functions would do when given more than one\n> args, but I cannot (yet) see the users of this function, which may be\n> doing their own sanity checking to avoid that situation, so...\n>\n>\n\nI did wonder about that myself, but with insufficient curiosity to\nactually write a test. I'll fix...\n\njon.\n"},{"id":"148064","messageId":"AANLkTi=U5HaHvXMjum3zpZgBRD68gPN=vk7f8iy7Q-VM@mail.gmail.com","threadId":"24665","inReplyTo":"7vr5i3mj4h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 9/9] Documentation: git stash branch now tolerates non-stash references.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-08-14T00:30:25Z","receivedAt":"2010-08-14T00:30:25Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Fri, Aug 13, 2010 at 10:49 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n> Hmm.\n>\n> Is there anything that describes how <stash-like>, <stash-entry> and\n> <stash> relate to each other?  I do not think a regular reader can answer\n> by reading the description after the patch these questions:\n>\n>  - Is a <stash-entry> a <stash-like>?\n>  - Is the opposite true?\n>\n> etc...\n>\n> Perhaps we can simply call these two-parent merge commits a <stash>,\n> define that these commands as working on a <stash>, add notes to certain\n> subcommands that the <stash> they take must be on the stash ref (as\n> opposed to a freestanding one you can create with \"stash create\"), and be\n> done with it?\n>\n> Also what is the error condition?  I am assuming that your <stash-entry>\n> is a <stash-like> that is on the reflog of refs/stash, but if you give a\n> <stash-like> that is not a <stash-entry> (iow a freestanding <stash>) to a\n> subcommand that wants to see <stash-entry>, what happens, and does the\n> document describe it as an error?\n>\n>> -pop [--index] [-q|--quiet] [<stash>]::\n>> +pop [--index] [-q|--quiet] [<stash-entry>]::\n>>\n>>       Remove a single stashed state from the stash list and apply it\n>>       on top of the current working tree state, i.e., do the inverse\n>\n\nOk, I'll have another crack at it, and address the other issues you\nhave noted in another round.\n\nThanks for the review.\n\njon.\n"}]}