summaryrefslogtreecommitdiff
path: root/git-stash.sh
diff options
context:
space:
mode:
authorKevin Leung <kevinlsk@gmail.com>2007-12-03 10:34:05 +0800
committerJunio C Hamano <gitster@pobox.com>2007-12-02 18:51:09 -0800
commit683befa1788a216ac31f68bb6e8ae906fd511ab2 (patch)
tree4fb1c1dab03d7fe37035618da945ffce2f4c4220 /git-stash.sh
parent6e9e0327b7d7f384d8a223b4bc40330ef3e7fb61 (diff)
downloadgit-683befa1788a216ac31f68bb6e8ae906fd511ab2.tar.gz
git-stash: Display help message if git-stash is run with wrong sub-commands
The current git-stash behaviour is very error prone to typos. For example, if you typed "git-stash llist", git-stash would think that you wanted to save to a stash named "llist", but in fact, you meant "git-stash list". Signed-off-by: Kevin Leung <kevinlsk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/git-stash.sh b/git-stash.sh
index b1529e28b1..f16fd9c3c0 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -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=
@@ -207,6 +207,10 @@ show)
shift
show_stash "$@"
;;
+save)
+ shift
+ save_stash "$*" && git-reset --hard
+ ;;
apply)
shift
apply_stash "$@"
@@ -221,14 +225,12 @@ 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 && git-reset --hard
+ else
+ usage
fi
- save_stash "$*" && git-reset --hard
;;
esac