From: Jon Seymour Date: Tue, 10 Aug 2010 00:04:43 GMT Subject: [PATCH v4 4/9] stash: teach git stash pop to fail early if the argument is not a stash ref Message-ID: <1281398688-21008-5-git-send-email-jon.seymour@gmail.com> In-Reply-To: <1281242771-24764-1-git-send-email-jon.seymour@gmail.com> With this change, git stash pop will fail early if a specified revision argument is not a valid stash reference. This fixes the case where the apply succeeds, but the drop fails which caused git stash pop to exit with a non-zero exit code and a dirty tree. Now, git stash pop fails with a non-zero exit code, but the tree is not modified. Signed-off-by: Jon Seymour --- git-stash.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index 41a9359..4f28c09 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -351,10 +351,10 @@ apply_stash () { } pop_stash() { - if apply_stash "$@" - then - drop_stash "$applied_stash" - fi + assert_stash_ref "$@" + + apply_stash "$@" && + drop_stash "$applied_stash" } drop_stash () { -- 1.6.5.rc3.8.g8ba5e