]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-stash.sh
Fix rewrite_diff() name quoting.
[thirdparty/git.git] / git-stash.sh
index b1529e28b1c4eb8b236bd497c83690c20621d369..06cb177ec6c10d21f128390edc5bfedfa05db9a9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright (c) 2007, Nanako Shiraishi
 
-USAGE='[ | list | show | apply | clear]'
+USAGE='[  | save | list | show | apply | clear | create ]'
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
@@ -99,7 +99,7 @@ save_stash () {
 
        git update-ref -m "$stash_msg" $ref_stash $w_commit ||
                die "Cannot save the current status"
-       printf >&2 'Saved "%s"\n' "$stash_msg"
+       printf >&2 'Saved working directory and index state "%s"\n' "$stash_msg"
 }
 
 have_stash () {
@@ -207,6 +207,10 @@ show)
        shift
        show_stash "$@"
        ;;
+save)
+       shift
+       save_stash "$*" && git-reset --hard
+       ;;
 apply)
        shift
        apply_stash "$@"
@@ -221,14 +225,14 @@ create)
        fi
        create_stash "$*" && echo "$w_commit"
        ;;
-help | usage)
-       usage
-       ;;
 *)
-       if test $# -gt 0 && test "$1" = save
+       if test $# -eq 0
        then
-               shift
+               save_stash &&
+               echo >&2 '(To restore them type "git stash apply")' &&
+               git-reset --hard
+       else
+               usage
        fi
-       save_stash "$*" && git-reset --hard
        ;;
 esac