* [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index'
[not found] <cover.1248719786u.git.johannes.schindelin@gmx.de>
@ 2009-07-27 18:37 ` Johannes Schindelin
2009-07-27 21:24 ` Sverre Rabbelier
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-07-27 18:37 UTC (permalink / raw)
To: git, gitster
To save me from the carpal tunnel syndrome, make 'git stash' accept
the short option '-k' instead of '--keep-index', and for even more
convenience, let's DWIM when this developer forgot to type the 'save'
command.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Documentation/git-stash.txt | 3 ++-
git-stash.sh | 16 +++++++++-------
t/t3903-stash.sh | 8 ++++++++
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 1c64a02..a031836 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -13,7 +13,8 @@ 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 [-k|--keep-index] [-q|--quiet] [<message>]]
+'git stash' [-k|--keep-index]
'git stash' clear
'git stash' create
diff --git a/git-stash.sh b/git-stash.sh
index 03e589f..13edc0e 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -7,7 +7,8 @@ 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 [-k|--keep-index] [-q|--quiet] [<message>]]
+ or: $dashless [-k|--keep-index]
or: $dashless clear"
SUBDIRECTORY_OK=Yes
@@ -98,7 +99,7 @@ save_stash () {
while test $# != 0
do
case "$1" in
- --keep-index)
+ -k|--keep-index)
keep_index=t
;;
-q|--quiet)
@@ -353,12 +354,13 @@ branch)
apply_to_branch "$@"
;;
*)
- if test $# -eq 0
- then
- save_stash &&
+ case $#,"$1" in
+ 0,|1,-k|1,--keep-index)
+ save_stash "$@" &&
say '(To restore them type "git stash apply")'
- else
+ ;;
+ *)
usage
- fi
+ esac
;;
esac
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 7a3fb67..e16ad93 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.3.2.734.g770e
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index'
2009-07-27 18:37 ` [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index' Johannes Schindelin
@ 2009-07-27 21:24 ` Sverre Rabbelier
2009-07-27 21:37 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Sverre Rabbelier @ 2009-07-27 21:24 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
Heya,
On Mon, Jul 27, 2009 at 11:37, Johannes
Schindelin<johannes.schindelin@gmx.de> wrote:
> To save me from the carpal tunnel syndrome, make 'git stash' accept
> the short option '-k' instead of '--keep-index', and for even more
> convenience, let's DWIM when this developer forgot to type the 'save'
> command.
+many, especially the DWIM part! Does it also grok 'git stash --keep-index'?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index'
2009-07-27 21:24 ` Sverre Rabbelier
@ 2009-07-27 21:37 ` Johannes Schindelin
2009-07-27 21:37 ` Sverre Rabbelier
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-07-27 21:37 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: git, gitster
Hi,
On Mon, 27 Jul 2009, Sverre Rabbelier wrote:
> On Mon, Jul 27, 2009 at 11:37, Johannes
> Schindelin<johannes.schindelin@gmx.de> wrote:
> > To save me from the carpal tunnel syndrome, make 'git stash' accept
> > the short option '-k' instead of '--keep-index', and for even more
> > convenience, let's DWIM when this developer forgot to type the 'save'
> > command.
>
> +many, especially the DWIM part! Does it also grok 'git stash
> --keep-index'?
Yes, it does, but it causes carpal tunnel.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index'
2009-07-27 21:37 ` Johannes Schindelin
@ 2009-07-27 21:37 ` Sverre Rabbelier
0 siblings, 0 replies; 4+ messages in thread
From: Sverre Rabbelier @ 2009-07-27 21:37 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
Heya,
On Mon, Jul 27, 2009 at 14:37, Johannes
Schindelin<Johannes.Schindelin@gmx.de> wrote:
> Yes, it does, but it causes carpal tunnel.
True that, but it's consistent at least :).
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-27 21:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1248719786u.git.johannes.schindelin@gmx.de>
2009-07-27 18:37 ` [PATCH] Make 'git stash -k' a short form for 'git stash save --keep-index' Johannes Schindelin
2009-07-27 21:24 ` Sverre Rabbelier
2009-07-27 21:37 ` Johannes Schindelin
2009-07-27 21:37 ` Sverre Rabbelier
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).