Tomas Carnecky reported a regression in the behaviour
of git stash branch, when the branch creation fails.
This patch fixes that regression by restoring the
pre-condition for dropping that previously existed.
This patch assumes Tomas Carnecky's patch has already been applied.
Signed-off-by: Jon Seymour <redacted>
---
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 23a9ab5..5fb1245 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -432,9 +432,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 0f6b2e4..336e244 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 &&--
1.7.3.4.g787b.dirty