git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] stash: accept options also when subcommand 'save' is omitted
@ 2009-08-18 12:46 Matthieu Moy
  2009-08-18 13:01 ` Matthieu Moy
  0 siblings, 1 reply; 22+ messages in thread
From: Matthieu Moy @ 2009-08-18 12:46 UTC (permalink / raw)
  To: git; +Cc: Matthieu Moy

This allows in particular 'git stash --keep-index' which is shorter than
'git stash save --keep-index', and not ambiguous.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Does this sound right?

I'm so used to 'git stash' (without saying 'save') that I keep typing
'git stash --keep-index', and get a usage string as an error message.

 Documentation/git-stash.txt |    2 +-
 git-stash.sh                |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 2f5ca7b..6f251e7 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -13,7 +13,7 @@ SYNOPSIS
 'git stash' drop [-q|--quiet] [<stash>]
 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
 'git stash' branch <branchname> [<stash>]
-'git stash' [save [--keep-index] [-q|--quiet] [<message>]]
+'git stash' [save] [--keep-index] [-q|--quiet] [<message>]
 'git stash' clear
 'git stash' create
 
diff --git a/git-stash.sh b/git-stash.sh
index 03e589f..2599410 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -7,7 +7,7 @@ USAGE="list [<options>]
    or: $dashless drop [-q|--quiet] [<stash>]
    or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
    or: $dashless branch <branchname> [<stash>]
-   or: $dashless [save [--keep-index] [-q|--quiet] [<message>]]
+   or: $dashless [save] [--keep-index] [-q|--quiet] [<message>]
    or: $dashless clear"
 
 SUBDIRECTORY_OK=Yes
@@ -302,6 +302,12 @@ apply_to_branch () {
 	drop_stash $stash
 }
 
+case "$1" in
+    -*)
+	set "save" "$@"
+	;;
+esac
+
 # Main command set
 case "$1" in
 list)
-- 
1.6.4.173.g0591

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

end of thread, other threads:[~2009-08-19  9:57 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 12:46 [RFC PATCH] stash: accept options also when subcommand 'save' is omitted Matthieu Moy
2009-08-18 13:01 ` Matthieu Moy
2009-08-18 17:45   ` Jeff King
2009-08-18 20:20     ` Junio C Hamano
2009-08-18 21:38       ` [PATCH 0/3] short syntaxes for 'git stash' Matthieu Moy
2009-08-18 21:38         ` [PATCH 1/3] stash: accept -k as a shortcut for --keep-index Matthieu Moy
2009-08-18 21:38           ` [PATCH 2/3] stash: accept options also when subcommand 'save' is omitted Matthieu Moy
2009-08-18 21:38             ` [PATCH 3/3] stash: reject stash name starting with a dash Matthieu Moy
2009-08-18 23:35               ` Jeff King
2009-08-18 23:45                 ` Junio C Hamano
2009-08-18 23:54                   ` Jeff King
2009-08-18 23:55                   ` Junio C Hamano
2009-08-19  6:57                 ` Matthieu Moy
2009-08-19  9:57                   ` Jeff King
2009-08-18 23:31         ` [PATCH 0/3] short syntaxes for 'git stash' Jeff King
2009-08-18 21:42     ` [RFC PATCH] stash: accept options also when subcommand 'save' is omitted Johannes Schindelin
2009-08-18 21:52       ` Matthieu Moy
2009-08-18 22:37         ` Johannes Schindelin
2009-08-19  7:14           ` Matthieu Moy
2009-08-18 22:30       ` Jeff King
2009-08-18 22:46         ` Johannes Schindelin
2009-08-18 23:06           ` Jeff King

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