[PATCH] git-stash: Display help message if git-stash is run without sub-commands

Subsystems: the rest

DORMANTno replies

5 messages, 4 authors, 2016-06-15 · open the first message on its own page

[PATCH] git-stash: Display help message if git-stash is run without sub-commands

From: Kevin Leung <hidden>
Date: 2016-06-15 22:43:55

The current git-stash behaviour is very error prone to typos. For example,
if you typed "git-stash llist", git-stash would thought that you wanted to
save to a stash named "llist", but in fact, you meant "git-stash list".

Signed-off-by: Kevin Leung <redacted>
---
 git-stash.sh |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 77c9421..dbb8894 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,7 @@ apply)
 clear)
        clear_stash
        ;;
-help | usage)
-       usage
-       ;;
 *)
-       if test $# -gt 0 && test "$1" = save
-       then
-               shift
-       fi
-       save_stash "$*" && git-reset --hard
+       usage
        ;;
 esac
-- 
1.5.3.6.36.g38762

Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands

From: Mike Hommey <hidden>
Date: 2016-06-15 22:43:55

On Fri, Nov 30, 2007 at 04:16:34PM +0800, Kevin Leung [off-list ref] wrote:
The current git-stash behaviour is very error prone to typos. For example,
if you typed "git-stash llist", git-stash would thought that you wanted to
save to a stash named "llist", but in fact, you meant "git-stash list".
Still, 'git stash' alone should *do* the stash.

Mike

Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands

From: Kevin Leung <hidden>
Date: 2016-06-15 22:43:55

On Nov 30, 2007 4:41 PM, Mike Hommey [off-list ref] wrote:
Still, 'git stash' alone should *do* the stash.
How about `git stash' still does the stash, and `git stash llist'
exits with usage message? And if you want to save the stash with name,
you can only do it with `git stash save name_of_stash'.

Kevin Leung

Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands

From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:43:55

El 30/11/2007, a las 10:09, Kevin Leung escribió:
On Nov 30, 2007 4:41 PM, Mike Hommey [off-list ref] wrote:
quoted
Still, 'git stash' alone should *do* the stash.
How about `git stash' still does the stash, and `git stash llist'
exits with usage message? And if you want to save the stash with name,
you can only do it with `git stash save name_of_stash'.
That's probably the way it should have been all along.

Cheers,
Wincent

Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:55

Hi,

On Fri, 30 Nov 2007, Kevin Leung wrote:
The current git-stash behaviour is very error prone to typos. For 
example, if you typed "git-stash llist", git-stash would thought that 
you wanted to save to a stash named "llist", but in fact, you meant 
"git-stash list".
I am fine with your patch.  I would be equally fine with "git stash" still 
choosing a default message and stashing.

And yes, I agree that the "git stash <whatever>" might be a little too 
error-prone.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help