Code

git diff too slow for a file
[git.git] / git-stash.sh
index 2d691963934c31242512bd4dd349d970c0350243..59db3dc38e72fda88d521171a174c08b919677a9 100755 (executable)
@@ -151,6 +151,7 @@ save_stash () {
                        ;;
                -*)
                        echo "error: unknown option for 'stash save': $1"
+                       echo "       To provide a message, use git stash save -- '$1'"
                        usage
                        ;;
                *)
@@ -209,14 +210,18 @@ list_stash () {
 }
 
 show_stash () {
+       have_stash || die 'No stash found'
+
        flags=$(git rev-parse --no-revs --flags "$@")
        if test -z "$flags"
        then
                flags=--stat
        fi
 
-       w_commit=$(git rev-parse --verify --default $ref_stash "$@") &&
-       b_commit=$(git rev-parse --verify "$w_commit^") &&
+       w_commit=$(git rev-parse --quiet --verify --default $ref_stash "$@") &&
+       b_commit=$(git rev-parse --quiet --verify "$w_commit^") ||
+               die "'$*' is not a stash"
+
        git diff $flags $b_commit $w_commit
 }