completion: make stash -p and alias for stash push -p
authorThomas Gummerer <t.gummerer@gmail.com>
Thu, 19 Apr 2018 23:25:14 +0000 (00:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Apr 2018 01:39:50 +0000 (10:39 +0900)
We define 'git stash -p' as an alias for 'git stash push -p' in the
manpage. Do the same in the completion script, so all options that
can be given to 'git stash push' are being completed when the user is
using 'git stash -p --<tab>'. Currently the only additional option
the user will get is '--message', but there may be more in the future.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
index 9a95b3b7b1599448e81b03e93205a773995f9382..adb6516b6d1b1e56cb00a15ac3cb8f58cdeabfc0 100644 (file)
@@ -2776,6 +2776,9 @@ _git_stash ()
        local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
        local subcommands='push list show apply clear drop pop create branch'
        local subcommand="$(__git_find_on_cmdline "$subcommands save")"
+       if [ -n "$(__git_find_on_cmdline "-p")" ]; then
+               subcommand="push"
+       fi
        if [ -z "$subcommand" ]; then
                case "$cur" in
                --*)