t0001-init.sh: use the $( ... ) construct for command substitution
[gitweb.git] / git-stash.sh
index f0a94abf1434c65d27caf4cd674f89de62e9333c..af549c731779db02db29fef446014a58bc9a3996 100755 (executable)
@@ -13,7 +13,7 @@ USAGE="list [<options>]
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
-START_DIR=`pwd`
+START_DIR=$(pwd)
 . git-sh-setup
 . git-sh-i18n
 require_work_tree
@@ -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 () {