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>
Kevin Leung committed
Dec 3, 2007 at 10:34 UTC
683befa1788a216ac31f68bb6e8ae906fd511ab2
1 file changed
+9
-7
git-stash.sh
+9
-7
@@ -1,7 +1,7 @@
1
#!/bin/sh
2
# Copyright (c) 2007, Nanako Shiraishi
3
4
-USAGE='[ | list | show | apply | clear]'
4
+USAGE='[ | save | list | show | apply | clear | create ]'
5
6
SUBDIRECTORY_OK=Yes
7
OPTIONS_SPEC=
@@ -207,6 +207,10 @@ show)
207
shift
208
show_stash "$@"
209
;;
210
+save)
211
+ shift
212
+ save_stash "$*" && git-reset --hard
213
+ ;;
214
apply)
215
shift
216
apply_stash "$@"
@@ -221,14 +225,12 @@ create)
225
fi
226
create_stash "$*" && echo "$w_commit"
227
;;
224
-help | usage)
225
- usage
226
- ;;
228
*)
228
- if test $# -gt 0 && test "$1" = save
229
+ if test $# -eq 0
230
then
230
- shift
231
+ save_stash && git-reset --hard
232
+ else
233
+ usage
234
fi
232
- save_stash "$*" && git-reset --hard
235
;;
236
esac