summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/git-stash.sh b/git-stash.sh
index f0a94ab..4621d81 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -94,7 +94,8 @@ create_stash () {
# ease of unpacking later.
u_commit=$(
untracked_files | (
- export GIT_INDEX_FILE="$TMPindex"
+ GIT_INDEX_FILE="$TMPindex" &&
+ export GIT_INDEX_FILE &&
rm -f "$TMPindex" &&
git update-index -z --add --remove --stdin &&
u_tree=$(git write-tree) &&
@@ -512,8 +513,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 () {