git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-stash: Display help message if git-stash is run with wrong sub-commands
@ 2007-12-03  2:34 Kevin Leung
  2007-12-03  2:48 ` Junio C Hamano
  2007-12-03  6:16 ` Wayne Davison
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Leung @ 2007-12-03  2:34 UTC (permalink / raw)
  To: Git ML, Junio C Hamano, Nanako Shiraishi

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>
---
 git-stash.sh |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 77c9421..a17cc25 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 ]'

 SUBDIRECTORY_OK=Yes
 . git-sh-setup
@@ -195,6 +195,10 @@ show)
        shift
        show_stash "$@"
        ;;
+save)
+       shift
+       save_stash "$@" && git-reset --hard
+       ;;
 apply)
        shift
        apply_stash "$@"
@@ -202,14 +206,12 @@ apply)
 clear)
        clear_stash
        ;;
-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
-- 
1.5.3.7-dirty

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-12-04 15:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03  2:34 [PATCH] git-stash: Display help message if git-stash is run with wrong sub-commands Kevin Leung
2007-12-03  2:48 ` Junio C Hamano
2007-12-03  3:36   ` Kevin Leung
2007-12-03  6:16 ` Wayne Davison
2007-12-03 10:25   ` Johannes Schindelin
2007-12-04 15:28     ` Wayne Davison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).