Merge branch 'dk/stash-completion-updates' into seen
The command-line completion for 'git stash' has been updated to dynamically discover subcommands and to correct a Zsh-specific formatting issue where stash references were improperly unquoted. Additionally, the deprecated 'save' subcommand has been removed from completions and synopsis documentation. * dk/stash-completion-updates: completion: drop "stash save" completion altogether doc: drop usage mentions of "git stash save" completion: fix Zsh handling of stash names completion: extract common stash listing code completion: simplify stash subcommand completionseen
commit
e2027e145e
|
|
@ -18,8 +18,6 @@ git stash [push] [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | -
|
|||
[-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
|
||||
[--pathspec-from-file=<file> [--pathspec-file-nul]]
|
||||
[--] [<pathspec>...]
|
||||
git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
|
||||
[-u | --include-untracked] [-a | --all] [<message>]
|
||||
git stash clear
|
||||
git stash create [<message>]
|
||||
git stash store [(-m | --message) <message>] [-q | --quiet] <commit>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ static const char * const git_stash_usage[] = {
|
|||
BUILTIN_STASH_APPLY_USAGE,
|
||||
BUILTIN_STASH_BRANCH_USAGE,
|
||||
BUILTIN_STASH_PUSH_USAGE,
|
||||
BUILTIN_STASH_SAVE_USAGE,
|
||||
BUILTIN_STASH_CLEAR_USAGE,
|
||||
BUILTIN_STASH_CREATE_USAGE,
|
||||
BUILTIN_STASH_STORE_USAGE,
|
||||
|
|
|
|||
|
|
@ -3553,17 +3553,18 @@ _git_sparse_checkout ()
|
|||
|
||||
_git_stash ()
|
||||
{
|
||||
local subcommands='push list show apply clear drop pop create branch import export'
|
||||
local subcommand="$(__git_find_on_cmdline "$subcommands save")"
|
||||
local subcommands subcommand
|
||||
|
||||
__git_resolve_builtins stash
|
||||
|
||||
subcommands="$___git_resolved_builtins"
|
||||
subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||
|
||||
if [ -z "$subcommand" ]; then
|
||||
case "$((cword - __git_cmd_idx)),$cur" in
|
||||
*,--*)
|
||||
__gitcomp_builtin stash_push
|
||||
;;
|
||||
1,sa*)
|
||||
__gitcomp "save"
|
||||
;;
|
||||
1,*)
|
||||
__gitcomp "$subcommands"
|
||||
;;
|
||||
|
|
@ -3589,20 +3590,23 @@ _git_stash ()
|
|||
if [ $cword -eq $((__git_cmd_idx+2)) ]; then
|
||||
__git_complete_refs
|
||||
else
|
||||
__gitcomp_nl "$(__git stash list \
|
||||
| sed -n -e 's/:.*//p')"
|
||||
__git_complete_stashes
|
||||
fi
|
||||
;;
|
||||
import,*)
|
||||
__git_complete_refs
|
||||
;;
|
||||
show,*|apply,*|drop,*|pop,*|export,*)
|
||||
__gitcomp_nl "$(__git stash list \
|
||||
| sed -n -e 's/:.*//p')"
|
||||
__git_complete_stashes
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_complete_stashes ()
|
||||
{
|
||||
__gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')"
|
||||
}
|
||||
|
||||
_git_submodule ()
|
||||
{
|
||||
__git_has_doubledash && return
|
||||
|
|
|
|||
|
|
@ -135,6 +135,11 @@ __gitcomp_file_direct ()
|
|||
__gitcomp_file "$1" ""
|
||||
}
|
||||
|
||||
__git_complete_stashes ()
|
||||
{
|
||||
compadd -S ' ' -- ${(f)"$(__git stash list | sed -n -e 's/:.*//p')"} && _ret=0
|
||||
}
|
||||
|
||||
_git_zsh ()
|
||||
{
|
||||
__gitcomp "v1.1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue