Skip to content

Commit 10bdb20

Browse files
committed
Merge branch 'jc/stash-pop-not-popped'
"stash pop", upon failing to apply the stash, refrains from discarding the stash to avoid information loss. Be more explicit in the error message. The wording may want to get a bit more bikeshedding. * jc/stash-pop-not-popped: stash pop: mention we did not drop the stash upon failing to apply
2 parents 1be645c + 2d4c993 commit 10bdb20

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

git-stash.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,14 @@ apply_stash () {
512512
pop_stash() {
513513
assert_stash_ref "$@"
514514

515-
apply_stash "$@" &&
516-
drop_stash "$@"
515+
if apply_stash "$@"
516+
then
517+
drop_stash "$@"
518+
else
519+
status=$?
520+
say "The stash is kept in case you need it again."
521+
exit $status
522+
fi
517523
}
518524

519525
drop_stash () {

0 commit comments

Comments
 (0)