File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ SYNOPSIS
13
13
'git stash' drop [-q|--quiet] [<stash>]
14
14
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
15
15
'git stash' branch <branchname> [<stash>]
16
- 'git stash' [save [--patch] [--[no-]keep-index] [-q|--quiet] [<message>]]
16
+ 'git stash' [save [--patch] [-k|--[no-]keep-index] [-q|--quiet] [<message>]]
17
+ 'git stash' [-k|--keep-index]
17
18
'git stash' clear
18
19
'git stash' create
19
20
Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ USAGE="list [<options>]
7
7
or: $dashless drop [-q|--quiet] [<stash>]
8
8
or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
9
9
or: $dashless branch <branchname> [<stash>]
10
- or: $dashless [save [--keep-index] [-q|--quiet] [<message>]]
10
+ or: $dashless [save [-k|--keep-index] [-q|--quiet] [<message>]]
11
+ or: $dashless [-k|--keep-index]
11
12
or: $dashless clear"
12
13
13
14
SUBDIRECTORY_OK=Yes
@@ -132,7 +133,7 @@ save_stash () {
132
133
while test $# ! = 0
133
134
do
134
135
case " $1 " in
135
- --keep-index)
136
+ -k|- -keep-index)
136
137
keep_index=t
137
138
;;
138
139
--no-keep-index)
@@ -405,12 +406,13 @@ branch)
405
406
apply_to_branch " $@ "
406
407
;;
407
408
* )
408
- if test $# -eq 0
409
- then
410
- save_stash &&
409
+ case $# , " $1 " in
410
+ 0,|1,-k|1,--keep-index)
411
+ save_stash " $@ " &&
411
412
say ' (To restore them type "git stash apply")'
412
- else
413
+ ;;
414
+ * )
413
415
usage
414
- fi
416
+ esac
415
417
;;
416
418
esac
Original file line number Diff line number Diff line change @@ -200,4 +200,12 @@ test_expect_success 'drop -q is quiet' '
200
200
test ! -s output.out
201
201
'
202
202
203
+ test_expect_success ' stash -k' '
204
+ echo bar3 > file &&
205
+ echo bar4 > file2 &&
206
+ git add file2 &&
207
+ git stash -k &&
208
+ test bar,bar4 = $(cat file),$(cat file2)
209
+ '
210
+
203
211
test_done
You can’t perform that action at this time.
0 commit comments