From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH 2/3] stash: accept options also when subcommand 'save' is omitted
Date: Tue, 18 Aug 2009 23:38:42 +0200 [thread overview]
Message-ID: <1250631523-10524-3-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1250631523-10524-2-git-send-email-Matthieu.Moy@imag.fr>
This allows in particular 'git stash -k which is shorter than
'git stash save -k', and not ambiguous.
Testcase taken from Johannes Schindelin <johannes.schindelin@gmx.de>.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Documentation/git-stash.txt | 2 +-
git-stash.sh | 8 +++++++-
t/t3903-stash.sh | 8 ++++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 1b5392a..7e515ce 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 [--patch] [--[no-]keep-index|-k] [-q|--quiet] [<message>]]
+'git stash' [save] [--patch] [--[no-]keep-index|-k] [-q|--quiet] [<message>]
'git stash' clear
'git stash' create
diff --git a/git-stash.sh b/git-stash.sh
index 856a2d5..bb36bc7 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 [-k|--keep-index] [-q|--quiet] [<message>]]
+ or: $dashless [save] [-k|--keep-index] [-q|--quiet] [<message>]
or: $dashless clear"
SUBDIRECTORY_OK=Yes
@@ -354,6 +354,12 @@ apply_to_branch () {
drop_stash $stash
}
+case "$1" in
+ -*)
+ set "save" "$@"
+ ;;
+esac
+
# Main command set
case "$1" in
list)
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 7a3fb67..0e831e0 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -200,4 +200,12 @@ test_expect_success 'drop -q is quiet' '
test ! -s output.out
'
+test_expect_success 'stash -k' '
+ echo bar3 > file &&
+ echo bar4 > file2 &&
+ git add file2 &&
+ git stash -k &&
+ test bar,bar4 = $(cat file),$(cat file2)
+'
+
test_done
--
1.6.4.rc2.31.g2d7d7
next prev parent reply other threads:[~2009-08-18 21:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Matthieu Moy [this message]
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
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=1250631523-10524-3-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).