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>
This commit is contained in:

committed by
Junio C Hamano

parent
6e9e0327b7
commit
683befa178
16
git-stash.sh
16
git-stash.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2007, Nanako Shiraishi
|
# Copyright (c) 2007, Nanako Shiraishi
|
||||||
|
|
||||||
USAGE='[ | list | show | apply | clear]'
|
USAGE='[ | save | list | show | apply | clear | create ]'
|
||||||
|
|
||||||
SUBDIRECTORY_OK=Yes
|
SUBDIRECTORY_OK=Yes
|
||||||
OPTIONS_SPEC=
|
OPTIONS_SPEC=
|
||||||
@ -207,6 +207,10 @@ show)
|
|||||||
shift
|
shift
|
||||||
show_stash "$@"
|
show_stash "$@"
|
||||||
;;
|
;;
|
||||||
|
save)
|
||||||
|
shift
|
||||||
|
save_stash "$*" && git-reset --hard
|
||||||
|
;;
|
||||||
apply)
|
apply)
|
||||||
shift
|
shift
|
||||||
apply_stash "$@"
|
apply_stash "$@"
|
||||||
@ -221,14 +225,12 @@ create)
|
|||||||
fi
|
fi
|
||||||
create_stash "$*" && echo "$w_commit"
|
create_stash "$*" && echo "$w_commit"
|
||||||
;;
|
;;
|
||||||
help | usage)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
if test $# -gt 0 && test "$1" = save
|
if test $# -eq 0
|
||||||
then
|
then
|
||||||
shift
|
save_stash && git-reset --hard
|
||||||
|
else
|
||||||
|
usage
|
||||||
fi
|
fi
|
||||||
save_stash "$*" && git-reset --hard
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user