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 3c2eb80f, ("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 <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Gummerer committed Feb 28, 2017 at 20:33 UTC 1ada5020b38c520f665259f6d9b3955672b92761
3 files changed +13 -15
Documentation/git-stash.txt
+4 -4
@@ -13,11 +13,11 @@ SYNOPSIS
13 'git stash' drop [-q|--quiet] [<stash>]
14 'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
15 '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]
19 [-u|--include-untracked] [-a|--all] [-m|--message <message>]]
20 - [--] [<pathspec>...]
20 + [--] [<pathspec>...]]
21 'git stash' clear
22 'git stash' create [<message>]
23 'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
git-stash.sh
+8 -8
@@ -7,11 +7,11 @@ USAGE="list [<options>]
7 or: $dashless drop [-q|--quiet] [<stash>]
8 or: $dashless ( pop | apply ) [--index] [-q|--quiet] [<stash>]
9 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>...]]
15 or: $dashless clear"
16
17 SUBDIRECTORY_OK=Yes
@@ -657,7 +657,7 @@ apply_to_branch () {
657 }
658
659 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
661 seen_non_option=
662 for opt
663 do
@@ -667,7 +667,7 @@ do
667 esac
668 done
669
670 -test -n "$seen_non_option" || set "save" "$@"
670 +test -n "$seen_non_option" || set "push" "$@"
671
672 # Main command set
673 case "$1" in
@@ -718,7 +718,7 @@ branch)
718 *)
719 case $# in
720 0)
721 - save_stash &&
721 + push_stash &&
722 say "$(gettext "(To restore them type \"git stash apply\")")"
723 ;;
724 *)
t/t3903-stash.sh
+1 -3
@@ -274,9 +274,7 @@ test_expect_success 'stash --invalid-option' '
274 git add file2 &&
275 test_must_fail git stash --invalid-option &&
276 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)
278 '
279
280 test_expect_success 'stash an added file' '