git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kevin Leung" <kevinlsk@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Git ML" <git@vger.kernel.org>,
	"Nanako Shiraishi" <nanako3@bluebottle.com>
Subject: Re: [PATCH] git-stash: Display help message if git-stash is run with wrong sub-commands
Date: Mon, 3 Dec 2007 11:36:59 +0800	[thread overview]
Message-ID: <e66701d40712021936p10ee73ddj9696d3a8b4092127@mail.gmail.com> (raw)
In-Reply-To: <7vwsrwqysf.fsf@gitster.siamese.dyndns.org>

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

 Thanks, Junio. It should be alright now.

 git-stash.sh |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 77c9421..844a3e5 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

  reply	other threads:[~2007-12-03  3:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-12-03  6:16 ` Wayne Davison
2007-12-03 10:25   ` Johannes Schindelin
2007-12-04 15:28     ` Wayne Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e66701d40712021936p10ee73ddj9696d3a8b4092127@mail.gmail.com \
    --to=kevinlsk@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nanako3@bluebottle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).