git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-stash: Display help message if git-stash is run without sub-commands
@ 2007-11-30  8:16 Kevin Leung
  2007-11-30  8:41 ` Mike Hommey
  2007-11-30 11:50 ` Johannes Schindelin
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Leung @ 2007-11-30  8:16 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 thought 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 |   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

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30  8:16 [PATCH] git-stash: Display help message if git-stash is run without sub-commands Kevin Leung
@ 2007-11-30  8:41 ` Mike Hommey
  2007-11-30  9:09   ` Kevin Leung
  2007-11-30 11:50 ` Johannes Schindelin
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Hommey @ 2007-11-30  8:41 UTC (permalink / raw)
  To: Kevin Leung; +Cc: Git ML, Junio C Hamano, Nanako Shiraishi

On Fri, Nov 30, 2007 at 04:16:34PM +0800, Kevin Leung <kevinlsk@gmail.com> 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

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30  8:41 ` Mike Hommey
@ 2007-11-30  9:09   ` Kevin Leung
  2007-11-30  9:19     ` Wincent Colaiuta
  2007-11-30 20:02     ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Leung @ 2007-11-30  9:09 UTC (permalink / raw)
  To: Mike Hommey; +Cc: Git ML, Junio C Hamano, Nanako Shiraishi

On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> 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

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30  9:09   ` Kevin Leung
@ 2007-11-30  9:19     ` Wincent Colaiuta
  2007-11-30 20:02     ` Junio C Hamano
  1 sibling, 0 replies; 7+ messages in thread
From: Wincent Colaiuta @ 2007-11-30  9:19 UTC (permalink / raw)
  To: Kevin Leung; +Cc: Mike Hommey, Git ML, Junio C Hamano, Nanako Shiraishi

El 30/11/2007, a las 10:09, Kevin Leung escribió:

> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> 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'.

That's probably the way it should have been all along.
>


Cheers,
Wincent

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30  8:16 [PATCH] git-stash: Display help message if git-stash is run without sub-commands Kevin Leung
  2007-11-30  8:41 ` Mike Hommey
@ 2007-11-30 11:50 ` Johannes Schindelin
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2007-11-30 11:50 UTC (permalink / raw)
  To: Kevin Leung; +Cc: Git ML, Junio C Hamano, Nanako Shiraishi

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

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30  9:09   ` Kevin Leung
  2007-11-30  9:19     ` Wincent Colaiuta
@ 2007-11-30 20:02     ` Junio C Hamano
  2007-11-30 20:11       ` David Kastrup
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-11-30 20:02 UTC (permalink / raw)
  To: Kevin Leung; +Cc: Mike Hommey, Git ML, Junio C Hamano, Nanako Shiraishi

"Kevin Leung" <kevinlsk@gmail.com> writes:

> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> 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'.

Sounds like a sensible thing to do.

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

* Re: [PATCH] git-stash: Display help message if git-stash is run without sub-commands
  2007-11-30 20:02     ` Junio C Hamano
@ 2007-11-30 20:11       ` David Kastrup
  0 siblings, 0 replies; 7+ messages in thread
From: David Kastrup @ 2007-11-30 20:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Kevin Leung, Mike Hommey, Git ML, Nanako Shiraishi

Junio C Hamano <gitster@pobox.com> writes:

> "Kevin Leung" <kevinlsk@gmail.com> writes:
>
>> On Nov 30, 2007 4:41 PM, Mike Hommey <mh@glandium.org> 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'.
>
> Sounds like a sensible thing to do.

Instead of "save", one could use "stash" since that is what it is
supposed to do.  Then

git stash stash stash

would create a stash called "stash".

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2007-11-30 20:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30  8:16 [PATCH] git-stash: Display help message if git-stash is run without sub-commands Kevin Leung
2007-11-30  8:41 ` Mike Hommey
2007-11-30  9:09   ` Kevin Leung
2007-11-30  9:19     ` Wincent Colaiuta
2007-11-30 20:02     ` Junio C Hamano
2007-11-30 20:11       ` David Kastrup
2007-11-30 11:50 ` Johannes Schindelin

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).