Skip to content

Commit

Permalink
Merge branch 'jc/stash-pop-not-popped'
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Mar 21, 2014
2 parents 1be645c + 2d4c993 commit 10bdb20
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,14 @@ apply_stash () {
pop_stash() {
assert_stash_ref "$@"

apply_stash "$@" &&
drop_stash "$@"
if apply_stash "$@"
then
drop_stash "$@"
else
status=$?
say "The stash is kept in case you need it again."
exit $status
fi
}

drop_stash () {
Expand Down

0 comments on commit 10bdb20

Please sign in to comment.