diff options
author | Phil Hord <phil.hord@gmail.com> | 2017-11-23 00:20:30 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-24 08:47:44 +0300 |
commit | 5675473fcbd18fb320ca17cffc107506f09c7464 (patch) | |
tree | b456661b1154e33dbab2aad67216432a95854503 /git-stash.sh | |
parent | fc849d8d6b90e5c1e0c37bc0d60dd92b2fe7347f (diff) |
stash: learn to parse -m/--message like commit does
`git stash push -m foo` uses "foo" as the message for the stash. But
`git stash push -m"foo"` does not parse successfully. Similarly
`git stash push --message="My stash message"` also fails. The stash
documentation doesn't suggest this syntax should work, but gitcli
does and my fingers have learned this pattern long ago for `commit`.
Teach `git stash` to parse -mFoo and --message=Foo the same as `git
commit` would do. Even though it's an internal function, add
similar support to create_stash() for consistency.
Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-x | git-stash.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/git-stash.sh b/git-stash.sh index 328cd80d83a..5a5b6b030cb 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -76,6 +76,12 @@ create_stash () { shift stash_msg=${1?"BUG: create_stash () -m requires an argument"} ;; + -m*) + stash_msg=${1#-m} + ;; + --message=*) + stash_msg=${1#--message=} + ;; -u|--include-untracked) shift untracked=${1?"BUG: create_stash () -u requires an argument"} @@ -193,6 +199,12 @@ store_stash () { shift stash_msg="$1" ;; + -m*) + stash_msg=${1#-m} + ;; + --message=*) + stash_msg=${1#--message=} + ;; -q|--quiet) quiet=t ;; @@ -251,6 +263,12 @@ push_stash () { test -z ${1+x} && usage stash_msg=$1 ;; + -m*) + stash_msg=${1#-m} + ;; + --message=*) + stash_msg=${1#--message=} + ;; --help) show_help ;; |