summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6517452)
raw | patch | inline | side by side (parent: 6517452)
author | Johannes Schindelin <johannes.schindelin@gmx.de> | |
Mon, 27 Jul 2009 18:37:10 +0000 (20:37 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 31 Jul 2009 14:33:06 +0000 (07:33 -0700) |
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-stash.txt | patch | blob | history | |
git-stash.sh | patch | blob | history | |
t/t3903-stash.sh | patch | blob | history |
index 1c64a02fe576a6bdad2afcbc96391ce0c2d541c4..a031836a26c562deb490819f9a7fe7e0c0034e9f 100644 (file)
'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 03e589f764ba0570559fdb23a9a11cc2a0f24044..13edc0eefd56507930055f57fa48c3bfb6863108 100755 (executable)
--- a/git-stash.sh
+++ b/git-stash.sh
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
while test $# != 0
do
case "$1" in
- --keep-index)
+ -k|--keep-index)
keep_index=t
;;
-q|--quiet)
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 7a3fb679571a9fc79135f8b9495462f723b663af..e16ad93d2c2718baf62ad90e9fc07187106d9ee4 100755 (executable)
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
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