Skip to content

Commit 1ada502

Browse files
tgummerergitster
authored andcommitted
stash: use stash_push for no verb form
Now that we have stash_push, which accepts pathspec arguments, use it instead of stash_save in git stash without any additional verbs. Previously we allowed git stash -- -message, which is no longer allowed after this patch. Messages starting with a hyphen was allowed since 3c2eb80, ("stash: simplify defaulting to "save" and reject unknown options"). However it was never the intent to allow that, but rather it was allowed accidentally. Signed-off-by: Thomas Gummerer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent df6bba0 commit 1ada502

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

Documentation/git-stash.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ SYNOPSIS
1313
'git stash' drop [-q|--quiet] [<stash>]
1414
'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
1515
'git stash' branch <branchname> [<stash>]
16-
'git stash' [save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
17-
[-u|--include-untracked] [-a|--all] [<message>]]
18-
'git stash' push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
16+
'git stash' save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
17+
[-u|--include-untracked] [-a|--all] [<message>]
18+
'git stash' [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
1919
[-u|--include-untracked] [-a|--all] [-m|--message <message>]]
20-
[--] [<pathspec>...]
20+
[--] [<pathspec>...]]
2121
'git stash' clear
2222
'git stash' create [<message>]
2323
'git stash' store [-m|--message <message>] [-q|--quiet] <commit>

git-stash.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ USAGE="list [<options>]
77
or: $dashless drop [-q|--quiet] [<stash>]
88
or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
99
or: $dashless branch <branchname> [<stash>]
10-
or: $dashless [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
11-
[-u|--include-untracked] [-a|--all] [<message>]]
12-
or: $dashless push [--patch] [-k|--[no-]keep-index] [-q|--quiet]
13-
[-u|--include-untracked] [-a|--all] [-m <message>]
14-
[-- <pathspec>...]
10+
or: $dashless save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
11+
[-u|--include-untracked] [-a|--all] [<message>]
12+
or: $dashless [push [--patch] [-k|--[no-]keep-index] [-q|--quiet]
13+
[-u|--include-untracked] [-a|--all] [-m <message>]
14+
[-- <pathspec>...]]
1515
or: $dashless clear"
1616

1717
SUBDIRECTORY_OK=Yes
@@ -657,7 +657,7 @@ apply_to_branch () {
657657
}
658658

659659
PARSE_CACHE='--not-parsed'
660-
# The default command is "save" if nothing but options are given
660+
# The default command is "push" if nothing but options are given
661661
seen_non_option=
662662
for opt
663663
do
@@ -667,7 +667,7 @@ do
667667
esac
668668
done
669669

670-
test -n "$seen_non_option" || set "save" "$@"
670+
test -n "$seen_non_option" || set "push" "$@"
671671

672672
# Main command set
673673
case "$1" in
@@ -718,7 +718,7 @@ branch)
718718
*)
719719
case $# in
720720
0)
721-
save_stash &&
721+
push_stash &&
722722
say "$(gettext "(To restore them type \"git stash apply\")")"
723723
;;
724724
*)

t/t3903-stash.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,7 @@ test_expect_success 'stash --invalid-option' '
274274
git add file2 &&
275275
test_must_fail git stash --invalid-option &&
276276
test_must_fail git stash save --invalid-option &&
277-
test bar5,bar6 = $(cat file),$(cat file2) &&
278-
git stash -- -message-starting-with-dash &&
279-
test bar,bar2 = $(cat file),$(cat file2)
277+
test bar5,bar6 = $(cat file),$(cat file2)
280278
'
281279

282280
test_expect_success 'stash an added file' '

0 commit comments

Comments
 (0)