From 57693d03db93959831c9c017953f979aae6cc8eb Mon Sep 17 00:00:00 2001 From: Jon Seymour Date: Tue, 28 Sep 2010 23:19:52 +1000 Subject: [PATCH] stash: fix git stash branch regression when branch creation fails "git stash branch " started discarding the stash when the branch creation fails. It should have kept the stash intact when aborting. Signed-off-by: Jon Seymour Signed-off-by: Junio C Hamano --- git-stash.sh | 6 +++--- t/t3903-stash.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git-stash.sh b/git-stash.sh index 57f36ce8dd..02113263e3 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -446,9 +446,9 @@ apply_to_branch () { assert_stash_like "$@" git checkout -b $branch $REV^ && - apply_stash "$@" - - test -z "$IS_STASH_REF" || drop_stash "$@" + apply_stash "$@" && { + test -z "$IS_STASH_REF" || drop_stash "$@" + } } PARSE_CACHE='--not-parsed' diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 4215cc6986..903a122efe 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -545,7 +545,7 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' ' git stash drop ' -test_expect_failure 'stash branch should not drop the stash if the branch exists' ' +test_expect_success 'stash branch should not drop the stash if the branch exists' ' git stash clear && echo foo >file && git add file && -- 2.11.4.GIT