diff --git a/git-stash.sh b/git-stash.sh
index 07ac3235904d7f0ac6c2e79af8b35f84c8f0874c..0a9403653d7dbbb6927973dcfcc41bfd9a904e05 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
keep_index=t
;;
--no-keep-index)
- keep_index=
+ keep_index=n
;;
-p|--patch)
patch_mode=t
- keep_index=t
+ # only default to keep if we don't already have an override
+ test -z "$keep_index" && keep_index=t
;;
-q|--quiet)
GIT_QUIET=t
then
git reset --hard ${GIT_QUIET:+-q}
- if test -n "$keep_index" && test -n $i_tree
+ if test "$keep_index" = "t" && test -n $i_tree
then
git read-tree --reset -u $i_tree
fi
git apply -R < "$TMP-patch" ||
die "Cannot remove worktree changes"
- if test -z "$keep_index"
+ if test "$keep_index" != "t"
then
git reset
fi