From 295133d741985565befd68330fd728710d9db5cc Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 20 Jan 2016 07:47:28 +0000 Subject: 37703: Completion: git: Also complete sendmail commands for send-email's configuration. (after 37666) --- Completion/Unix/Command/_git | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5f137d009..65916f01e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2268,7 +2268,7 @@ _git-config () { sendemail.suppressfrom:'add From\: address to the Cc\: list::->bool:false' sendemail.to:'value of To\: header::_email_addresses' sendemail.smtpdomain:'FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains' - sendemail.smtpserver:'SMTP server to connect to:smtp host:_hosts' + sendemail.smtpserver:'SMTP server to connect to:smtp host: __git_sendmail_smtpserver_values' sendemail.smtpserveroption:'specifies the outgoing SMTP server option to use:SMTP server option:->string' sendemail.smtpserverport:'port to connect to SMTP server on:smtp port:_ports' sendemail.smtpsslcertpath:'path to ca-certificates (directory or file):ca certificates path:_files' @@ -2293,7 +2293,7 @@ _git-config () { 'sendemail.*.suppressfrom:rules for suppressing From\:::->sendemail.suppressfrom' 'sendemail.*.to:value of To\: header::_email_addresses' 'sendemail.*.smtpdomain:FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains' - 'sendemail.*.smtpserver:SMTP server to connect to:smtp host:_hosts' + 'sendemail.*.smtpserver:SMTP server to connect to:smtp host: __git_sendmail_smtpserver_values' 'sendemail.*.smtpserveroption:specifies the outgoing SMTP server option to use:SMTP server option:->string' 'sendemail.*.smtpserverport:port to connect to SMTP server on:smtp port:_ports' 'sendemail.*.smtpuser:user to use for SMTP-AUTH:smtp user:_users' -- cgit v1.2.3 From 8a59aed6967b5283cbf0c7d32559b11d3a841a37 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 9 Feb 2016 03:23:20 +0000 Subject: 37924: Completion: _git: Complete files for 'check-ignore' Also, don't leak the parameter 'ret'; the leak was theoretical because the caller immediately wrote to that parameter. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 40349a82f..76add9f27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-02-09 Daniel Shahaf + * 37924: Completion/Unix/Command/_git: Completion: _git: + Complete files for 'check-ignore' + * 37923: Completion/Debian/Command/_bts: Completion: _bts: Fix quoting of $DEBEMAIL. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 65916f01e..b7eaf2e49 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -406,7 +406,7 @@ _git-check-ignore () { '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \ '(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \ '--no-index[do not look in the index when undertaking the checks]' \ - '*:: :->file' && ret=0 + '*:: :_files' } (( $+functions[_git-check-mailmap] )) || -- cgit v1.2.3 From 983060d5d12e44558913f4c9d7e03ddd4a69f408 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Tue, 8 Mar 2016 21:21:44 +0900 Subject: 38074: _git reset HEAD: complete only staged files --- Completion/Unix/Command/_git | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b7eaf2e49..7a459f1fb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1377,7 +1377,11 @@ _git-reset () { if [[ -n $line[1] ]] && __git_is_committish $line[1]; then commit=$line[1] fi - __git_tree_files ${PREFIX:-.} $commit && ret=0 + if [[ $commit == HEAD ]]; then + __git_ignore_line __git_staged_files && ret=0 + else + __git_ignore_line __git_tree_files ${PREFIX:-.} $commit && ret=0 + fi ;; esac @@ -6131,6 +6135,29 @@ __git_tree_files () { _wanted files expl 'tree file' _multi_parts -f $compadd_opts -- / tree_files } +(( $+functions[__git_staged_files] )) || +__git_staged_files () { + local -a slist staged_files + local item expl i + + slist=(${(0)"$(_call_program staged-files git status -z -uno 2>/dev/null)"}) + __git_command_successful $pipestatus || return 1 + + for (( i = 1; i <= $#slist; ++i )) do + item=$slist[i] + if [[ $item == (DD|AA|U|?U)* ]]; then + continue #XXX skip unmerged files + elif [[ $item == R* ]]; then + staged_files+=( $item[4,-1] $slist[++i] ) + elif [[ $item == [ACDM]* ]]; then + staged_files+=( $item[4,-1] ) + fi + done + staged_files=( ${(0)"$(__git_files_relative ${(pj:\0:)staged_files})"} ) + + _wanted staged-files expl 'staged file' compadd "$@" -a - staged_files +} + # Repository Argument Types (( $+functions[__git_remote_repositories] )) || -- cgit v1.2.3 From 33bd9136d6700dcef772a48dc565fe11a7dfb85a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 9 Mar 2016 14:06:49 +0000 Subject: 38120: _git: Document the internal helper function __git_ignore_line. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index be61bd073..b99eee7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-09 Daniel Shahaf + + * 38120: Completion/Unix/Command/_git: Document the internal + helper function __git_ignore_line. + 2016-03-08 Peter Stephenson * 38114: Src/exec.c: In substitutions involving subshells, disable diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7a459f1fb..2dd9a8028 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5038,6 +5038,16 @@ __git_describe_commit () { # Completion Wrappers +# '__git_ignore_line $callee "${callee_args[@]}" "${callee_compadd_args[@]}"' +# invokes '$callee "${callee_args[@]}" "${callee_compadd_args[@]}"' with +# callee_compadd_args modified to exclude positional parameters to the completed +# command from being completed. This causes 'git add foo ' not to offer +# 'foo' again. +# +# Note: This function can't be used to wrap bare 'compadd' calls that use a '--' +# argument terminator. It can wrap functions of the form +# f() { shift $N; compadd "$@" -a - mymatches } +# . (( $+functions[__git_ignore_line] )) || __git_ignore_line () { declare -a ignored -- cgit v1.2.3 From be41c522f2e02982f66c080f23b6a54c10c4c091 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 9 Mar 2016 22:11:22 +0000 Subject: 38123 (after 38074): _git reset $treeish: complete only staged files --- ChangeLog | 5 ++++ Completion/Unix/Command/_git | 56 ++++++++++++++++---------------------------- 2 files changed, 25 insertions(+), 36 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 105a040ae..63d8fd792 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-10 Daniel Shahaf + + * 38123 (after 38074): Completion/Unix/Command/_git: _git reset + $treeish: complete only staged files + 2016-03-09 Daniel Shahaf * 38120: Completion/Unix/Command/_git: Document the internal diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2dd9a8028..f0ad3d95d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1373,16 +1373,11 @@ _git-reset () { case $state in (file) - local commit=HEAD - if [[ -n $line[1] ]] && __git_is_committish $line[1]; then - commit=$line[1] + local tree=HEAD + if [[ -n $line[1] ]] && __git_is_treeish $line[1]; then + tree=$line[1] fi - if [[ $commit == HEAD ]]; then - __git_ignore_line __git_staged_files && ret=0 - else - __git_ignore_line __git_tree_files ${PREFIX:-.} $commit && ret=0 - fi - ;; + __git_ignore_line __git_treeish-to-index_files $tree && ret=0 esac return ret @@ -6077,16 +6072,28 @@ __git_killed_files () { __git_files --killed killed-files 'killed file' $* } -(( $+functions[__git_changed-in-index_files] )) || -__git_changed-in-index_files () { +(( $+functions[__git_diff-index_files] )) || +__git_diff-index_files () { + local tree=$1 description=$2 tag=$3; shift 3 local files expl - files=$(_call_program files git diff-index -z --name-only --no-color --cached HEAD 2>/dev/null) + files=$(_call_program files git diff-index -z --name-only --no-color --cached $tree 2>/dev/null) __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) __git_command_successful $pipestatus || return 1 - _wanted changed-in-index-files expl 'changed in index file' _multi_parts $@ - / files + _wanted $tag expl $description _multi_parts $@ - / files +} + +(( $+functions[__git_changed-in-index_files] )) || +__git_changed-in-index_files () { + __git_diff-index_files HEAD 'changed in index file' changed-in-index-files "$@" +} + +(( $+functions[__git_treeish-to-index_files] )) || +__git_treeish-to-index_files () { + local tree=$1; shift + __git_diff-index_files $tree "files different between ${(qq)tree} and the index" treeish-to-index-files "$@" } (( $+functions[__git_changed-in-working-tree_files] )) || @@ -6145,29 +6152,6 @@ __git_tree_files () { _wanted files expl 'tree file' _multi_parts -f $compadd_opts -- / tree_files } -(( $+functions[__git_staged_files] )) || -__git_staged_files () { - local -a slist staged_files - local item expl i - - slist=(${(0)"$(_call_program staged-files git status -z -uno 2>/dev/null)"}) - __git_command_successful $pipestatus || return 1 - - for (( i = 1; i <= $#slist; ++i )) do - item=$slist[i] - if [[ $item == (DD|AA|U|?U)* ]]; then - continue #XXX skip unmerged files - elif [[ $item == R* ]]; then - staged_files+=( $item[4,-1] $slist[++i] ) - elif [[ $item == [ACDM]* ]]; then - staged_files+=( $item[4,-1] ) - fi - done - staged_files=( ${(0)"$(__git_files_relative ${(pj:\0:)staged_files})"} ) - - _wanted staged-files expl 'staged file' compadd "$@" -a - staged_files -} - # Repository Argument Types (( $+functions[__git_remote_repositories] )) || -- cgit v1.2.3 From 98fcdb0861af6462d233f6199568d64b01fb7b08 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Mar 2016 23:15:51 +0000 Subject: 38128: _git: Fix completion of diffs against the index when treeish isn't shell-safe This affects 'git diff --cached -- ' and 'git reset $treeish '. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 63d8fd792..34be26e2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-10 Daniel Shahaf + * 38128: Completion/Unix/Command/_git: Fix completion of diffs + against the index when treeish isn't shell-safe + * 38123 (after 38074): Completion/Unix/Command/_git: _git reset $treeish: complete only staged files diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f0ad3d95d..6c88ad073 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6077,7 +6077,8 @@ __git_diff-index_files () { local tree=$1 description=$2 tag=$3; shift 3 local files expl - files=$(_call_program files git diff-index -z --name-only --no-color --cached $tree 2>/dev/null) + # $tree needs to be escaped for _call_program; matters for $tree = "HEAD^" + files=$(_call_program files git diff-index -z --name-only --no-color --cached ${(q)tree} 2>/dev/null) __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) __git_command_successful $pipestatus || return 1 -- cgit v1.2.3 From 527badc237cf1afd44c7215838ce69ae28dd35d8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Mar 2016 23:20:54 +0000 Subject: 38129: _git: Fix __git_ignore_line's treatment of shell and pattern metacaracters. Builds upon a patch by Jun T. Also upgrade/fix __git_pattern_escape. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 34be26e2e..0e7d1e023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-11 Daniel Shahaf + + * 38129: Completion/Unix/Command/_git: Fix __git_ignore_line's + treatment of shell and pattern metacaracters. + 2016-03-10 Daniel Shahaf * 38128: Completion/Unix/Command/_git: Fix completion of diffs diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6c88ad073..e3d7231d3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4956,7 +4956,7 @@ __git_committish_range_last () { (( $+functions[__git_pattern_escape] )) || __git_pattern_escape () { - print -r -n ${1//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH} + print -r -n - ${(b)1} } (( $+functions[__git_is_type] )) || @@ -5048,9 +5048,9 @@ __git_ignore_line () { declare -a ignored ignored=() ((CURRENT > 1)) && - ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ignored+=(${(bQ)line[1,CURRENT-1]}) ((CURRENT < $#line)) && - ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ignored+=(${(bQ)line[CURRENT+1,-1]}) $* -F ignored } -- cgit v1.2.3 From 666a7f5845ee88f4e736a4f0f3921c69314eb15c Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sun, 13 Mar 2016 23:01:57 +0100 Subject: 38148: _git: reflog: complete references next to commands 'git reflog show' is the default subcommand, so git reflog should complete subcommands and references. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 9e61f564d..e55cb1ce3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 m0viefreak + + * 38148: Completion/Unix/Command/_git: reflog: complete + references next to commands + 2016-03-11 Daniel Shahaf * 38135: Src/Zle/complete.c: internal: bin_compadd: Add a diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e3d7231d3..ea2d4857a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -3069,7 +3069,9 @@ _git-reflog () { 'delete:delete entries from reflog' 'show:show log of ref') - _describe -t commands command commands && ret=0 + _alternative \ + 'commands:: _describe -t commands command commands' \ + 'references:: __git_references' && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*}-$line[1]: -- cgit v1.2.3 From a1f45b3346f2c2d10e51c2a33bd98b1161334c67 Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sun, 13 Mar 2016 23:01:58 +0100 Subject: 38151: _git: fix tag name of remote branches --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index e55cb1ce3..71d8e12a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-15 m0viefreak + * 38151: Completion/Unix/Command/_git: fix tag name of remote + branches + * 38148: Completion/Unix/Command/_git: reflog: complete references next to commands diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ea2d4857a..12410582a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -457,7 +457,7 @@ _git-checkout () { if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B local branch_arg='' \ - remote_branch_noprefix_arg='remote branches::__git_remote_branch_names_noprefix' \ + remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ tree_ish_arg='tree-ishs::__git_tree_ishs' \ file_arg='modified-files::__git_modified_files' -- cgit v1.2.3 From 67136df0bf5d4b75e10c37fb19d49c28e098f052 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:43 +0000 Subject: 38180: _git: Improve reflog completion. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, only used by «git reflog delete ». --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 6c6e286e2..b708d3e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-03-21 Daniel Shahaf + + * 38180: Completion/Unix/Command/_git: Improve reflog completion. + 2016-03-21 Peter Stephenson * m0viefreak: 38145: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Make diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 12410582a..9eeda5837 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5474,10 +5474,10 @@ __git_reflog_entries () { local expl declare -a reflog_entries - reflog_entries=(${${${(f)"$(_call_program reflog-entries git reflog 2>/dev/null)"}#* }%%:*}) + reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 - _wanted reflog-entries expl 'reflog entry' _multi_parts @ reflog_entries + _describe -Vx -t reflog-entries 'reflog entry' reflog_entries } (( $+functions[__git_ref_sort_keys] )) || -- cgit v1.2.3 From ce4c9eafc491aad1213a1cc8e3c6e07057a01e4b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:44 +0000 Subject: 38181: _git reflog: Complete '@{N}' instead of 'HEAD@{N}'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The «HEAD@{...}» syntax is no longer completed, since it's not easily possible to support both syntaxes (workers/34768). --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 1 + 2 files changed, 4 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index b708d3e58..ab799d1eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-21 Daniel Shahaf + * 38181: Completion/Unix/Command/_git: _git reflog: Complete + '@{N}' instead of 'HEAD@{N}'. + * 38180: Completion/Unix/Command/_git: Improve reflog completion. 2016-03-21 Peter Stephenson diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 9eeda5837..0eb8532e2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5475,6 +5475,7 @@ __git_reflog_entries () { declare -a reflog_entries reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) + reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} ) __git_command_successful $pipestatus || return 1 _describe -Vx -t reflog-entries 'reflog entry' reflog_entries -- cgit v1.2.3 From 9f7040471473f5dedf0ae71a1973bc2606624aea Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:45 +0000 Subject: 38182: _git: Invoke reflog completion from the 'complete commit objects' codepath. The reflog will only be used if the user has typed as "@" by hand. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index ab799d1eb..d8f5cb50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-21 Daniel Shahaf + * 38182: Completion/Unix/Command/_git: Invoke reflog completion + from the 'complete commit objects' codepath. + * 38181: Completion/Unix/Command/_git: _git reflog: Complete '@{N}' instead of 'HEAD@{N}'. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 0eb8532e2..ee455764f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5474,7 +5474,9 @@ __git_reflog_entries () { local expl declare -a reflog_entries - reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) + # Repeat the %gD on the RHS due to uniquify the matches, to avoid bad + # completion list layout. (Compare workers/34768) + reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs (%gD)'" 2>/dev/null)"}) reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} ) __git_command_successful $pipestatus || return 1 @@ -5671,8 +5673,13 @@ __git_commit_objects () { local gitdir expl start declare -a commits - # Abort if the argument does not match a commit hash (including empty). - [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]] || return 1 + if [[ -n $PREFIX[(r)@] ]] || [[ -n $SUFFIX[(r)@] ]]; then + # doesn't match a commit hash, but might be a reflog entry + __git_reflog_entries; return $? + elif ! [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]]; then + # Abort if the argument does not match a commit hash (including empty). + return 1 + fi # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 -- cgit v1.2.3 From 4df62e32fcca80e6869b27bb7823a95337c984ca Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 6 Apr 2016 06:50:42 +0000 Subject: 38255: _git: Fix argument pastedness. Found by searching for /-\w\>.*:/. This covers short options only, from the top of file through _git-tag(). --- ChangeLog | 4 +++ Completion/Unix/Command/_git | 86 ++++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 43 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index b6fb070ca..bf20a5f23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-04-09 Daniel Shahaf + + * 38255: Completion/Unix/Command/_git: Fix argument pastedness. + 2016-04-07 Barton E. Schaefer * 38248: Src/Zle/zle_tricky.c: fix word position calculation diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ee455764f..7ce5b2bed 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -100,7 +100,7 @@ _git-am () { # undocumented (and not implemented here). _arguments -S \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \ '--keep-non-patch[pass -b to git mailinfo]' \ @@ -327,7 +327,7 @@ _git-branch () { "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \ "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \ - "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \ + "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \ "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ @@ -433,13 +433,13 @@ _git-checkout () { '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \ '(-q --quiet --theirs --patch)--ours[check out stage #2 for unmerged paths]' \ '(-q --quiet --ours --patch)--theirs[check out stage #3 for unmerged paths]' \ - '( -B --orphan --ours --theirs --conflict --patch --detach)-b[create a new branch based at given commit]: :__git_branch_names' \ - '(-b --orphan --ours --theirs --conflict --patch --detach)-B[create or update branch based at given commit]: :__git_branch_names' \ + '( -B --orphan --ours --theirs --conflict --patch --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ + '(-b --orphan --ours --theirs --conflict --patch --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \ $new_branch_reflog_opt \ '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \ - '(-b -B -t --track --patch --detach)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \ + '(-b -B -t --track --patch --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \ '--ignore-skip-worktree-bits[ignores patterns and adds back any files in ]' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \ @@ -503,13 +503,13 @@ _git-cherry-pick () { '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \ '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \ '(--ff)-x[append information about what commit was cherry-picked]' \ - '(-m --mainline)'{-m,--mainline}'[specify mainline when cherry-picking a merge commit]:parent number' \ + '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \ '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ ': : __git_commit_ranges -O expl:git_commit_opts' } @@ -530,7 +530,7 @@ _git-clean () { '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \ '(-q --quiet)'{-q,--quiet}'[only report errors]' \ - '*'{-e,--exclude=}'[skip files matching specified pattern]:pattern' \ + '*'{-e+,--exclude=}'[skip files matching specified pattern]:pattern' \ '(-X )-x[also remove ignored files]' \ '( -x)-X[remove only ignored files]' \ '*: :->file' && ret=0 @@ -597,9 +597,9 @@ _git-clone () { '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \ '(-o --origin)--bare[make a bare GIT repository]' \ '(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \ - '(-o --origin --bare)'{-o,--origin}'[use given remote name instead of "origin"]: :__git_guard_branch-name' \ - '(-b --branch)'{-b,--branch}'[point HEAD to the given branch]: :__git_guard_branch-name' \ - '(-u --upload-pack)'{-u,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \ + '(-o --origin --bare)'{-o+,--origin=}'[use given remote name instead of "origin"]: :__git_guard_branch-name' \ + '(-b --branch)'{-b+,--branch=}'[point HEAD to the given branch]: :__git_guard_branch-name' \ + '(-u --upload-pack)'{-u+,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \ '--template=[directory to use as a template for the object database]: :_directories' \ '*'{-c,--config}'[= set a configuration variable in the newly created repository]' \ '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \ @@ -673,7 +673,7 @@ _git-commit () { '--no-post-rewrite[bypass the post-rewrite hook]' \ '(-a --all --interactive -o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \ '(-a --all --interactive -o --only -i --include)'{-o,--only}'[commit only the given files]' \ - '(-u --untracked-files)'{-u-,--untracked-files=}'[show files in untracked directories]::mode:((no\:"show no untracked files" + '(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files" normal\:"show untracked files and directories" all\:"show individual files in untracked directories"))' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \ @@ -687,11 +687,11 @@ _git-commit () { $amend_opt \ '*: :__git_ignore_line_inside_arguments __git_changed_files' \ - '(message)' \ - {-C,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ - {-c,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ - {-F,--file=}'[read commit message from given file]: :_files' \ - {-m,--message=}'[use the given message as the commit message]:message' \ - {-t,--template=}'[use file as a template commit message]:template:_files' + {-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ + {-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ + {-F+,--file=}'[read commit message from given file]: :_files' \ + {-m+,--message=}'[use the given message as the commit message]:message' \ + {-t+,--template=}'[use file as a template commit message]:template:_files' } (( $+functions[_git-describe] )) || @@ -853,7 +853,7 @@ _git-format-patch () { _arguments -w -C -S -s \ $diff_options \ '--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \ - '(-o --output-directory --stdout)'{-o,--output-directory}'[store resulting files in given directory]: :_directories' \ + '(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \ '(-n --numbered -N --no-numbered -k --keep-subject)'{-n,--numbered}'[name output in \[PATCH n/m\] format]' \ '(-n --numbered -N --no-numbered -k --keep-subject)'{-N,--no-numbered}'[name output in \[PATCH\] format]' \ '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \ @@ -869,7 +869,7 @@ _git-format-patch () { '(--thread )--no-thread[do not thread messages]' \ '--in-reply-to=[make the first mail a reply to the given message]:message id' \ '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \ - '(-v --reroll-count)'{-v,--reroll-count=}'[mark the series as the -th iteration of the topic]: :__git_guard_number iteration' \ + '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the -th iteration of the topic]: :__git_guard_number iteration' \ '(-k --keep-subject)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ '*--to=[add To: header to email headers]: :_email_addresses' \ '*--cc=[add Cc: header to email headers]: :_email_addresses' \ @@ -949,20 +949,20 @@ _git-grep () { '(-n --line-number)'{-n,--line-number}'[prefix the line number to matching lines]' \ '(-l --files-with-matches -L --files-without-match --name-only)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \ '(-l --files-with-matches -L --files-without-match)'{-L,--files-without-match}'[show only names of non-matching files]' \ - '(--cached -O --open-files-in-pager)'{-O,--open-files-in-pager=}'-[open matching files in pager]:pager:_cmdstring' \ + '(--cached -O --open-files-in-pager)'{-O+,--open-files-in-pager=}'-[open matching files in pager]:pager:_cmdstring' \ '(-z --null)'{-z,--null}'[output \0 after filenames]' \ '(-c --count)'{-c,--count}'[show number of matching lines in files]' \ '( --no-color)--color=-[color matches]:: :__git_color_whens' \ '(--color )--no-color[do not color matches]' \ '--break[prefix the line number to matching lines]' \ '--heading[show the filename above the matches]' \ - '(-A --after-context)'{-A,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-B --before-context)'{-B,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-A --after-context -B --before-context -C --context)'{-C,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-A --after-context)'{-A+,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-B --before-context)'{-B+,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ '(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ - '(1)*-f[read patterns from given file]:pattern file:_files' \ - '(1)*-e[use the given pattern for matching]:pattern' \ + '(1)*-f+[read patterns from given file]:pattern file:_files' \ + '(1)*-e+[use the given pattern for matching]:pattern' \ $pattern_operators \ '--all-match[all patterns must match]' \ ':pattern' \ @@ -1135,7 +1135,7 @@ _git-merge () { _arguments -w -S -s \ $merge_options \ - '-m[set the commit message to be used for the merge commit]:merge message' \ + '-m+[set the commit message to be used for the merge commit]:merge message' \ '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ @@ -1204,10 +1204,10 @@ _git-notes () { # TODO: Only complete commits that don't have notes already, unless # -f or --force has been given. _arguments -w -S -s \ - '*'{-m,--message=}'[use given note message]:message' \ - '*'{-F,--file=}'[take note message from given file]:note message file:_files' \ - '(-C --reuse-message)'{-C,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ - '(-c --reedit-message)'{-c,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ + '*'{-m+,--message=}'[use given note message]:message' \ + '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ + '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ + '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ '(-f --force)'{-f,--force}'[overwrite existing note]' \ ': :__git_commits' && ret=0 ;; @@ -1231,10 +1231,10 @@ _git-notes () { ;; (append) _arguments -w -S -s \ - '*'{-m,--message=}'[use given note message]:message' \ - '*'{-F,--file=}'[take note message from given file]:note message file:_files' \ - '(-C --reuse-message)'{-C,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ - '(-c --reedit-message)'{-c,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ + '*'{-m+,--message=}'[use given note message]:message' \ + '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ + '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ + '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ ': :__git_commits' && ret=0 ;; (*) @@ -1327,10 +1327,10 @@ _git-rebase () { '--keep-empty[keep empty commits in the result]' \ '(- :)--skip[skip the current patch]' \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ '--no-verify[bypass the pre-rebase hook]' \ @@ -1342,7 +1342,7 @@ _git-rebase () { '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ '--edit-todo[edit interactive instruction sheet in an editor]' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ - {-x,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ + {-x+,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ @@ -1394,7 +1394,7 @@ _git-revert () { '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ ': :__git_commits' } @@ -1707,7 +1707,7 @@ _git-submodule () { '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ '--cached[use commit stored in the index]' \ '--files[compare commit in index with submodule HEAD commit]' \ - '(-n --summary-limit)'{-n,--summary-limit}'[limit summary size]: :__git_guard_number "limit"' \ + '(-n --summary-limit)'{-n,--summary-limit=}'[limit summary size]: :__git_guard_number "limit"' \ '(-)--[start submodule arguments]' \ '*:: :->commit-or-submodule' && ret=0 @@ -1760,7 +1760,7 @@ _git-tag () { - creation \ '( -s -u --local-user)-a[create an unsigned, annotated tag]' \ '(-a -u --local-user)-s[create an signed and annotated tag]' \ - '(-a -s)'{-u,--local-user}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ + '(-a -s)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '-f[replace existing tag]' \ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ $message_opts \ -- cgit v1.2.3 From 442d702bbc33adafe75ed4ca4ad8b0404eb52584 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 23 Apr 2016 20:43:17 +0000 Subject: 38316: _git-rebase: Complete any committish for the second argument --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 0710a0d82..03eba5fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-04-23 Daniel Shahaf + + * 38316: Completion/Unix/Command/_git: _git-rebase: Complete + any committish for the second argument + 2016-04-23 m0viefreak * 38291: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Change names of diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7ce5b2bed..3b48b4ec1 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1350,7 +1350,7 @@ _git-rebase () { '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ - '::working branch:__git_branch_names' + '::working branch:__git_revisions' } (( $+functions[_git-reset] )) || -- cgit v1.2.3 From 2979122d2d8fe6604840d209d13b8645e2ef142e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:40:36 +0000 Subject: _git-bundle: Complete required file argument to 'git bundle' correctly. --- Completion/Unix/Command/_git | 1 + 1 file changed, 1 insertion(+) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 3b48b4ec1..135da9f85 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -388,6 +388,7 @@ _git-bundle () { ;; (list-heads|unbundle) _arguments \ + ':bundle:_files' \ '*: :__git_ref_specs' && ret=0 ;; esac -- cgit v1.2.3 From 3e26848ef4e1a9dfd1893dca1646086dfcad9f6d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:53:48 +0000 Subject: _git: Offer alternatives properly. --- Completion/Unix/Command/_git | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 135da9f85..d7b874a90 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5638,8 +5638,7 @@ __git_commits () { (( $+functions[__git_heads] )) || __git_heads () { - __git_heads_local "$@" - __git_heads_remote "$@" + _alternative 'heads-local::__git_heads_local' 'heads-remote::__git_heads_remote' } (( $+functions[__git_heads_local] )) || -- cgit v1.2.3 From c57d8dfcaa40a8bbf8c38f2a2accc1a7e8090b69 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:59:25 +0000 Subject: _git: Fix an apparent typo in __git_heads(). I couldn't reproduce different behaviour with and without this patch, although the called command's output differs. --- Completion/Unix/Command/_git | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index d7b874a90..15829021d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5646,7 +5646,7 @@ __git_heads_local () { local gitdir declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do @@ -5663,7 +5663,7 @@ __git_heads_local () { __git_heads_remote () { declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/remotes 2>/dev/null)"}) __git_describe_commit heads heads-remote "remote head" "$@" } -- cgit v1.2.3 From fe21e49a6d97c0dbbb6694da00f132b8416e4b99 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:41:23 +0000 Subject: _git: Bifurcate __git_ref_specs. No functional change, except for completion of 'git bundle' and 'git config branch.*.merge'; this is a required groundwork for future patches. --- Completion/Unix/Command/_git | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 15829021d..37ac3e0fd 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -389,7 +389,7 @@ _git-bundle () { (list-heads|unbundle) _arguments \ ':bundle:_files' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_references' && ret=0 ;; esac ;; @@ -826,7 +826,7 @@ _git-fetch () { case $state in (repository-or-group-or-refspec) if (( CURRENT > 1 )) && [[ -z ${opt_args[(I)--multiple]} ]]; then - __git_ref_specs && ret=0 + __git_ref_specs_fetchy && ret=0 else _alternative \ 'remotes::__git_remotes' \ @@ -1262,7 +1262,7 @@ _git-pull () { '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ $fetch_options \ ': :__git_any_repositories' \ - '*: :__git_ref_specs' + '*: :__git_ref_specs_fetchy' } (( $+functions[_git-push] )) || @@ -1296,7 +1296,7 @@ _git-push () { '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ ': :__git_any_repositories' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_ref_specs_pushy' && ret=0 case $state in (lease) @@ -1936,7 +1936,7 @@ _git-config () { branch.autosetupmerge:'set up new branches for git pull::->bool:true' branch.autosetuprebase:'rebase new branches of merge for autosetupmerge::->branch.autosetuprebase:never' 'branch.*.remote:what remote git fetch and git push should fetch form/push to::__git_remotes' - 'branch.*.merge:default refspec to be marked for merging::__git_ref_specs' + 'branch.*.merge:default refspec to be marked for merging::__git_remote_references' 'branch.*.mergeoptions:default options for merging::->branch.mergeoptions' 'branch.*.pushremote:what remote git push should push to::__git_remotes' 'branch.*.rebase:rebase on top of fetched branch::->bool:false' @@ -2236,8 +2236,8 @@ _git-config () { 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' - 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs' - 'remote.*.push:default set of refspecs for git push::__git_ref_specs' + 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs_fetchy' + 'remote.*.push:default set of refspecs for git push::__git_ref_specs_pushy' 'remote.*.mirror:push with --mirror::->bool:false' 'remote.*.skipDefaultUpdate:skip this remote by default::->bool:false' 'remote.*.skipFetchAll:skip this remote by default::->bool:false' @@ -2330,7 +2330,7 @@ _git-config () { 'svn-remote.*.rewriteUUID:remap URLs and UUIDs for mirrors manually::->bool:false' 'svn-remote.*.ignore-paths:regular expression of paths to not check out:regular expression:->string' 'svn-remote.*.url:URL to connect to::_urls' - 'svn-remote.*.fetch:fetch specification::__git_ref_specs' + 'svn-remote.*.fetch:fetch specification::__git_ref_specs_fetchy' # ### undocumented 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' @@ -5349,8 +5349,8 @@ __git_remotes () { _wanted remotes expl remote compadd "$@" -a - remotes } -(( $+functions[__git_ref_specs] )) || -__git_ref_specs () { +(( $+functions[__git_ref_specs_pushy] )) || +__git_ref_specs_pushy () { # TODO: This needs to deal with a lot more types of things. if compset -P '*:'; then # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only @@ -5367,6 +5367,20 @@ __git_ref_specs () { fi } +(( $+functions[__git_ref_specs_fetchy] )) || +__git_ref_specs_fetchy () { + # TODO: this is wrong + __git_ref_specs_pushy "$@" +} + +(( $+functions[__git_ref_specs] )) || +__git_ref_specs () { + # Backwards compatibility: define this function to support user dotfiles that + # define custom _git-${subcommand} completions in terms of this function. + # ### We may want to warn here "use _pushy() or _fetchy()". + __git_ref_specs_pushy "$@" +} + (( $+functions[__git_color_whens] )) || __git_color_whens () { local -a whens -- cgit v1.2.3 From 276a690a2ea7f9a4cf20748c955eea4dbe2f2d02 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 09:10:18 +0000 Subject: _git: Complete fetchy refspecs correctly. --- Completion/Unix/Command/_git | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 37ac3e0fd..d3002075f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5369,8 +5369,19 @@ __git_ref_specs_pushy () { (( $+functions[__git_ref_specs_fetchy] )) || __git_ref_specs_fetchy () { - # TODO: this is wrong - __git_ref_specs_pushy "$@" + # TODO: This needs to deal with a lot more types of things. + if compset -P '*:'; then + __git_heads_local + else + compset -P '+' + if compset -S ':*'; then + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix + else + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix -qS : + fi + fi } (( $+functions[__git_ref_specs] )) || -- cgit v1.2.3 From 058d957ce53d98252ee7ca138b020a461d56a3f3 Mon Sep 17 00:00:00 2001 From: Russell Currey Date: Tue, 3 May 2016 16:41:24 +1000 Subject: 38393: _git: Fix typo in completion of '--minimal' Signed-off-by: Russell Currey --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index d2f0e23ca..48e10582f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-03 Russell Currey + + * 38393: Completion/Unix/Command/_git: Fix typo in completion of + '--minimal' + 2016-05-02 Barton E. Schaefer * 38375 (tweaked per 38384): Test/C02cond.ztst: try harder to diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index d3002075f..2fa004a5e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6320,7 +6320,7 @@ __git_setup_diff_options () { $diff_types'--raw[generate default raw diff output]' $diff_types'--patch-with-raw[generate patch but also keep the default raw diff output]' $diff_types{-s,--no-patch}'[suppress diff output]' - '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is producedm]' + '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is produced]' '(--minimal --patience --histogram --diff-algorithm)--patience[generate diffs with patience algorithm]' '(--minimal --patience --histogram --diff-algorithm)--histogram[generate diffs with histogram algorithm]' '(--minimal --patience --histogram --diff-algorithm)--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm" -- cgit v1.2.3 From 713eaa055d3914a06b71fe39581486c5b2bef60a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 2 Jun 2016 13:29:09 +0000 Subject: 38576: _git: Also detect _git-${thirdparty} functions in $fpath that are symlinks. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 5d679dacc..7572a06b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Daniel Shahaf + + * 38576: Completion/Unix/Command/_git: Also detect + _git-${thirdparty} functions in $fpath that are symlinks. + 2016-06-02 Eric Cook * 38567: Marko Myllynen: Completion/Unix/Command/_locale: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2fa004a5e..1dca28802 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7022,7 +7022,7 @@ declare -gUa _git_third_party_commands _git_third_party_commands=() local file -for file in ${^fpath}/_git-*~(*~|*.zwc)(.N); do +for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do local name=${${file:t}#_git-} if (( $+_git_third_party_commands[$name] )); then continue -- cgit v1.2.3 From 6e834587eb3ade36241f5803daa7aa0148e324fc Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 4 Jun 2016 09:19:54 +0000 Subject: 38592 (plus tweak): _git: New recent branches completion, unused. (Joint with Nils Luxton) --- ChangeLog | 5 ++++ Completion/Unix/Command/_git | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index b066f208e..52e891464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-07 Daniel Shahaf + + * 38592 (plus tweak): Completion/Unix/Command/_git: New recent + branches completion, unused. (Joint with Nils Luxton) + 2016-06-07 Barton E. Schaefer * 38630: Src/builtin.c: fix infinite loop of "hash =" diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1dca28802..9e572e25d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5640,6 +5640,66 @@ __git_commit_objects_prefer_recent () { __git_recent_commits $argument_array_names || __git_commit_objects } +# This function returns in $reply recently-checked-out refs' names, in order +# from most to least recent. +(( $+functions[__git_recent_branches__names] )) || +__git_recent_branches__names() +{ + local -a reflog + local reflog_subject + local new_head + local -A seen + reply=() + + reflog=(${(ps:\0:)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs' 2>/dev/null)"}) + for reflog_subject in $reflog; do + new_head=${${=reflog_subject}[4]} + + # Skip values added in previous iterations. + if (( ${+seen[$new_head]} )); then + continue + fi + seen[$new_head]="" # value is ignored + + # Filter out hashes, to leave only ref names. + if [[ $new_head =~ '^[0-9a-f]{40}$' ]]; then + continue + fi + + # All checks passed. Add it. + reply+=( $new_head ) + done +} + +(( $+functions[__git_recent_branches] )) || +__git_recent_branches() { + local -a branches descriptions + local branch description + local -a reply + + __git_recent_branches__names \ + ; for branch in $reply + do + # ### We'd want to convert all $reply to $descriptions in one shot, + # ### with this: + # ### array=("${(ps:\0:)"$(_call_program descriptions git --no-pager log --no-walk=unsorted -z --pretty=%s ${(q)reply} --)"}") + # ### , but git croaks if any of the positional arguments is a ref name + # ### that has been deleted. (So does 'git rev-parse'.) + # ### Hence, we resort to fetching the descriptions one-by-one. + # ### This would be costly if fork() is expensive. + description="$(_call_program description git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branch} --)" + + # If the ref has been deleted, $description would be empty. + if [[ -n "$description" ]]; then + branches+=$branch + descriptions+="${branch//:/\:}:${description}" + fi + done + + _describe -V -t recent-branches "recent branches" descriptions branches +} + + (( $+functions[__git_commits] )) || __git_commits () { local -a argument_array_names -- cgit v1.2.3 From 0516736eae23f5dd3839e3a5abe250d48c4d7d3c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 7 Jun 2016 06:20:40 +0000 Subject: 38624: _git: Optimize the last commit's __git_recent_branches__names as suggested by Matthew. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 33 +++++++++------------------------ 2 files changed, 12 insertions(+), 24 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 52e891464..13f6b28f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-07 Daniel Shahaf + * 38624: Completion/Unix/Command/_git: Optimize the last commit's + __git_recent_branches__names as suggested by Matthew. + * 38592 (plus tweak): Completion/Unix/Command/_git: New recent branches completion, unused. (Joint with Nils Luxton) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 9e572e25d..cc38d4bcf 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5645,30 +5645,15 @@ __git_commit_objects_prefer_recent () { (( $+functions[__git_recent_branches__names] )) || __git_recent_branches__names() { - local -a reflog - local reflog_subject - local new_head - local -A seen - reply=() - - reflog=(${(ps:\0:)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs' 2>/dev/null)"}) - for reflog_subject in $reflog; do - new_head=${${=reflog_subject}[4]} - - # Skip values added in previous iterations. - if (( ${+seen[$new_head]} )); then - continue - fi - seen[$new_head]="" # value is ignored - - # Filter out hashes, to leave only ref names. - if [[ $new_head =~ '^[0-9a-f]{40}$' ]]; then - continue - fi - - # All checks passed. Add it. - reply+=( $new_head ) - done + # This parameter expansion does the following: + # 1. Obtains the last 1000 'checkout' operations from the reflog + # 2. Extracts the move-source from each + # 3. Eliminates duplicates + # 4. Eliminates commit hashes (leaving only ref names) + # + # See workers/38592 for an equivalent long-hand implementation, and the rest + # of that thread for why this implementation was chosen instead. + reply=(${${(u)${${(0)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs')"}#checkout: moving from }%% *}:#[[:xdigit:]](#c40)}) } (( $+functions[__git_recent_branches] )) || -- cgit v1.2.3 From ec7088296beeb8599120486ebfd3040377e3575d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 12 Jun 2016 14:29:55 +0000 Subject: 38665: _git: config option completion: Quote properly. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 8952bd009..fffa8cedd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Daniel Shahaf + + * 38665: Completion/Unix/Command/_git: config option completion: + Quote properly. + 2016-06-12 Barton E. Schaefer * 38670: Doc/Zsh/contrib.yo, Functions/Zle/add-zle-hook-widget: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index cc38d4bcf..f868d46cf 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2567,7 +2567,7 @@ _git-config () { __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+\..*$' gettable-color-options option && ret=0 ;; (value) - local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get '$line[1]'")"}#*$'\n'} + local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get ${(q)line[1]}")"}#*$'\n'} case $line[1] in (alias.*) if [[ -n $current ]]; then @@ -6706,7 +6706,7 @@ __git_config_get_regexp () { [[ -n $opts[-a] ]] || opts[-a]='.[^.]##' [[ $1 == -- ]] && shift - set -A $2 ${${${(0)"$(_call_program ${3:-$2} "git config -z --get-regexp -- '$1'")"}#${~opts[-b]}}%%${~opts[-a]}$'\n'*} + set -A $2 ${${${(0)"$(_call_program ${3:-$2} "git config -z --get-regexp -- ${(q)1}")"}#${~opts[-b]}}%%${~opts[-a]}$'\n'*} } (( $+functions[__git_config_sections] )) || -- cgit v1.2.3 From aa160fc8e962c2f6df62c62d67e366644457966c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 10 Jun 2016 17:36:48 +0000 Subject: 38651: _git: Escape parameter arguments to _call_program. Fixes 'git cat-file blob HEAD^:' and a few other cases. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index fffa8cedd..b31543b4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-13 Daniel Shahaf + * 38651: Completion/Unix/Command/_git: Escape parameter arguments + to _call_program. + * 38665: Completion/Unix/Command/_git: config option completion: Quote properly. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f868d46cf..8bcdff3f9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2567,7 +2567,7 @@ _git-config () { __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+\..*$' gettable-color-options option && ret=0 ;; (value) - local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get ${(q)line[1]}")"}#*$'\n'} + local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local]" ${(kv)opt_args[(I)-f|--file]} "-z --get ${(q)line[1]}")"}#*$'\n'} case $line[1] in (alias.*) if [[ -n $current ]]; then @@ -5777,7 +5777,7 @@ __git_recent_commits () { # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") + commits=("${(f)"$(_call_program commits git --no-pager log ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") __git_command_successful $pipestatus || return 1 for i j k parents in "$commits[@]" ; do @@ -5987,7 +5987,7 @@ __git_tags_of_type () { type=$1; shift - tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) + tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags @@ -6099,12 +6099,12 @@ __git_files () { local pref=$gitcdup$gitprefix$PREFIX # First allow ls-files to pattern-match in case of remote repository - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\\\*} 2>/dev/null)"}) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"}) __git_command_successful $pipestatus || return # If ls-files succeeded but returned nothing, try again with no pattern if [[ -z "$files" && -n "$pref" ]]; then - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- 2>/dev/null)"}) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"}) __git_command_successful $pipestatus || return fi @@ -6221,7 +6221,7 @@ __git_tree_files () { shift (( at_least_one_tree_added = 0 )) for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r $extra_args --name-only -z $tree 2>/dev/null)"}) + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done @@ -6292,7 +6292,7 @@ __git_guard () { __git_guard_branch-name () { if [[ -n $PREFIX$SUFFIX ]]; then - _call_program check-ref-format git check-ref-format "refs/heads/$PREFIX$SUFFIX" &>/dev/null + _call_program check-ref-format git check-ref-format "refs/heads/"${(q)PREFIX}${(q)SUFFIX} &>/dev/null (( ${#pipestatus:#0} > 0 )) && return 1 fi -- cgit v1.2.3 From 59bf331d27ea29902870daeb50a47c13788fa7a7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 23 Jun 2016 15:55:20 +0000 Subject: unposted: _git-config: Fix syntax error in 'tag.sort' completion. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 76cb77e58..215f8b2a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-25 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-config: Fix + syntax error in 'tag.sort' completion. + * 38652: Test/ztst.zsh: test harness: Emit unified diffs instead of context diffs diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8bcdff3f9..46e290788 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2334,7 +2334,7 @@ _git-config () { 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' - tag.sort:'Default sorting method:->string' + tag.sort:'default sorting method:sorting method:->string' 'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_cmdstring' 'tar.*.remote:enable for use by remote clients via git-upload-archive::->bool' tar.umask:'umask to apply::->umask' -- cgit v1.2.3 From 3bd8abc40bf9c218e1ddd23bfd804422b0684c0a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 3 Jun 2016 11:40:54 +0000 Subject: unposted: _git-config: Document some line noise. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 +++ 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 215f8b2a6..c2f15f6a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-25 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-config: Document + some line noise. + * unposted: Completion/Unix/Command/_git: _git-config: Fix syntax error in 'tag.sort' completion. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 46e290788..5cc144963 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2371,7 +2371,9 @@ _git-config () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend + # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.foo.bar'. options+=(${${${${(M)git_options_static:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) + # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.*.bar'. options+=(${${${${(M)git_options_static:#(#i)${IPREFIX%%.*}.\*.[^.:]##:*}#(#i)${IPREFIX%%.*}.\*.}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) declare -a labels @@ -2420,6 +2422,7 @@ _git-config () { 'gitcvs.ext:ext-connection-method-specific options' 'gitcvs.pserver:pserver-connection-method-specific options' 'notes.rewrite:commands to copy notes from original for when rewriting commits') + # Set $sections to the applicable subsection names (e.g., 'decorate:...' if $IPREFIX == "color.") sections+=(${${(M)subsections:#${IPREFIX}[^.:]##(.|):*}#${IPREFIX}}) # TODO: Is it fine to use functions like this before _describe below, -- cgit v1.2.3 From 3a034838b4a76924a7fff98c269c9c3ea3136d45 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 25 Jun 2016 16:34:58 +0000 Subject: 38760: _git-config: Stop trying to execute the empty string command name upon completing values for an unknown option. For example: % git config x.y.z +_git-config:834> case x.y.z (alias.*) +_git-config:834> case x.y.z (remotes.*) +_git-config:860> local z=$'\C-@' +_git-config:861> declare -a parts +_git-config:862> parts=( '' ) +_git-config:863> (( 1 < 2 )) +_git-config:863> [[ x.y.z == [^.]##.*.[^.]## ]] +_git-config:864> parts=( '' ) +_git-config:866> (( 1 > 0 )) +_git-config:867> case (-\>*) +_git-config:867> case (*) +_git-config:1197> declare -a action +_git-config:1198> _description values expl '' +_git-config:1199> eval 'action=()' +(eval):1> action=( ) +_git-config:1200> '' -J values _git-config:1200: permission denied: +_git-config:1206> return ret --- ChangeLog | 6 ++++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index c2f15f6a5..503b905f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-06-27 Daniel Shahaf + + * 38760: Completion/Unix/Command/_git: _git-config: Stop trying + to execute the empty string command name upon completing values + for an unknown option. + 2016-06-25 Daniel Shahaf * unposted: Completion/Unix/Command/_git: _git-config: Document diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5cc144963..739fff1db 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2603,7 +2603,7 @@ _git-config () { if (( $#parts < 2 )) && [[ $line[1] == [^.]##.*.[^.]## ]]; then parts=("${(S@0)${git_options_static[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}") fi - (( $#parts > 0 )) || return ret + (( $#parts >= 4 )) || return ret case $parts[4] in ('->'*) case ${parts[4]#->} in -- cgit v1.2.3 From 92d516cfa7686b58ba7731b942766e706cae29ae Mon Sep 17 00:00:00 2001 From: Jordan Klassen Date: Tue, 5 Jul 2016 23:22:11 +0200 Subject: users/21551 (tweaked per users/21560): new git subtree completion --- ChangeLog | 5 +++ Completion/Unix/Command/_git | 92 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 470c13e72..7bf719390 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-05 Oliver Kiddle + + * Jordan Klassen: users/21551 (tweaked per users/21560): + Completion/Unix/Command/_git: new git subtree completion + 2016-07-05 Daniel Shahaf * 38728: Test/D02glob.ztst: Tests: Add tests for the ':a' and diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 739fff1db..73273ad43 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1747,6 +1747,91 @@ _git-submodule () { return ret } +(( $+functions[_git-subtree] )) || +_git-subtree () { + local curcontext="$curcontext" state state_descr line ret=1 + declare -A opt_args + + # TODO: -P should only complete paths inside the current repository. + _arguments -C \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '-d[show debug messages]' \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + + commands=( + add:'create the subtree by importing its contents' + merge:'merge recent changes up to specified commit into the subtree' + pull:'fetch from remote repository and merge recent changes into the subtree' + push:'does a split and `git push`' + split:'extract a new synthetic project history from a subtree') + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (add) + _arguments \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_any_repositories_or_references' \ + ':: :__git_ref_specs' && ret=0 + ;; + (merge) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_references' && ret=0 + ;; + (pull) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_any_repositories' \ + ':: :__git_ref_specs' && ret=0 + ;; + (push) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + ': :__git_any_repositories' \ + ':: :__git_ref_specs' && ret=0 + ;; + (split) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-b --branch)'{-b,--branch=}'[create a new branch]' \ + '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--ignore-joins[ignore prior --rejoin commits]' \ + '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ + '--rejoin[use the given message as the commit message for the merge commit]' \ + '*: :__git_references' && ret=0 + ;; + (*) + _default && ret=0 + ;; + esac + ;; + esac + + return ret +} + (( $+functions[_git-tag] )) || _git-tag () { local -a message_opts @@ -6274,6 +6359,13 @@ __git_any_repositories () { 'remote-repositories::__git_remote_repositories' } +(( $+functions[__git_any_repositories_or_references] )) || +__git_any_repositories_or_references () { + _alternative \ + 'repositories::__git_any_repositories' \ + 'references::__git_references' +} + # Common Guards (( $+functions[__git_guard] )) || -- cgit v1.2.3 From d09cb7e979bc5186a8d322ef8977884371bbc462 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 13 Jul 2016 04:54:00 +0000 Subject: users/21750 (after users/21551): _git-subtree: Tweak -m,-P completions --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4945c1a02..ebfe5b774 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-17 Daniel Shahaf + + * users/21750 (after users/21551): Completion/Unix/Command/_git: + _git-subtree: Tweak -m,-P completions + 2016-07-17 Oliver Kiddle * 38868: Completion/BSD/Command/_freebsd-update, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 73273ad43..98f06a3e2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1755,7 +1755,7 @@ _git-subtree () { # TODO: -P should only complete paths inside the current repository. _arguments -C \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '-d[show debug messages]' \ ': :->command' \ '*::: := ->option-or-argument' && ret=0 @@ -1779,8 +1779,8 @@ _git-subtree () { (add) _arguments \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories_or_references' \ ':: :__git_ref_specs' && ret=0 @@ -1788,16 +1788,16 @@ _git-subtree () { (merge) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_references' && ret=0 ;; (pull) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 @@ -1805,18 +1805,18 @@ _git-subtree () { (push) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 ;; (split) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '(-b --branch)'{-b,--branch=}'[create a new branch]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--ignore-joins[ignore prior --rejoin commits]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ '--rejoin[use the given message as the commit message for the merge commit]' \ -- cgit v1.2.3 From db9f0d3b3e5f0211b50cdf422b99cffce8655d09 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 14 Jul 2016 12:33:21 +0000 Subject: unposted (cf. users/21737):: _git-subtree: Record technical debt in comment. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index ebfe5b774..d8441b6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-17 Daniel Shahaf + * unposted (cf. users/21737):: Completion/Unix/Command/_git: + _git-subtree: Record technical debt in comment. + * users/21750 (after users/21551): Completion/Unix/Command/_git: _git-subtree: Tweak -m,-P completions diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 98f06a3e2..5954c55e5 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1784,6 +1784,10 @@ _git-subtree () { '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories_or_references' \ ':: :__git_ref_specs' && ret=0 + # TODO: the use of __git_ref_specs isn't quite right: it will + # complete "foo:bar" values which git-subtree(1) doesn't take. What + # we should complete here is what's on *one* side of the colon in + # __git_ref_specs. ;; (merge) _arguments -S \ -- cgit v1.2.3 From 3afaebd913d08e778546fd208aff6a4df1b96337 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 23 Jul 2016 14:01:20 +0000 Subject: unposted: _git-grep: Stop leaking the parameter $i. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 7aa5ae6e5..cb6ab4379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-23 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-grep: Stop + leaking the parameter $i. + * unposted: Completion/Debian/Type/_deb_packages: Minor optimization. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5954c55e5..b6da32962 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -973,7 +973,7 @@ _git-grep () { # don't complete treeishs. case $state in (tree-or-file) - integer first_tree last_tree start end + integer first_tree last_tree start end i (( start = words[(I)(-f|-e)] > 0 ? 1 : 2 )) (( end = $#line - 1 )) -- cgit v1.2.3 From 4f5cc54560dd95c4db6487a26d40c4b133ff1229 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 25 Jul 2016 00:06:57 +0200 Subject: 38939: add missing git options In particular those for GPG signing a push --- ChangeLog | 3 ++ Completion/Unix/Command/_git | 67 ++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 24 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4fb827c71..0813e74cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-24 Oliver Kiddle + * 38939: Completion/Unix/Command/_git: add missing options, + in particular those for GPG signing a push + * 38936: Functions/Zle/vi-pipe: fix for option compatibility * 38929: Doc/Zsh/contrib.yo, Functions/Zle/select-word-match: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b6da32962..b54b208fb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -510,7 +510,7 @@ _git-cherry-pick () { '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ ': : __git_commit_ranges -O expl:git_commit_opts' } @@ -1149,6 +1149,7 @@ _git-mv () { declare -A opt_args _arguments -w -C -S -s \ + '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \ @@ -1278,7 +1279,7 @@ _git-push () { '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \ '(-n --dry-run)'{-n,--dry-run}'[do everything except actually send the updates]' \ '--porcelain[produce machine-readable output]' \ - '--delete[delete all listed refs from the remote repository]' \ + '(-d --delete)'{-d,--delete}'[delete all listed refs from the remote repository]' \ '--tags[all tags under refs/tags are pushed]' \ '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ @@ -1295,6 +1296,12 @@ _git-push () { '(--verify)--no-verify[bybass the pre-push hook]' \ '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ + '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + '(--no-signed --sign)--signed[GPG sign the push]' \ + "(--sign --sign)--no-signed[don't GPG sign the push]" \ + '--atomic[request atomic transaction on remote side]' \ + '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ + '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :__git_any_repositories' \ '*: :__git_ref_specs_pushy' && ret=0 @@ -1323,17 +1330,21 @@ _git-rebase () { fi _arguments -A '-*' \ - '(- :)--continue[continue after resolving merge conflict]' \ - '(- :)--abort[abort current rebase]' \ - '--keep-empty[keep empty commits in the result]' \ - '(- :)--skip[skip the current patch]' \ + - actions \ + '(-)--continue[continue after resolving merge conflict]' \ + '(-)--abort[abort current rebase]' \ + '(-)--edit-todo[edit interactive instruction sheet in an editor]' \ + '(-)--skip[skip the current patch]' \ + - options \ + "--keep-empty[keep empty commits in the result]" \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ + '--rerere-autoupdate[allow rerere to update index with resolved conflicts' \ '--no-verify[bypass the pre-rebase hook]' \ '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ @@ -1341,13 +1352,13 @@ _git-rebase () { '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \ '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ - '--edit-todo[edit interactive instruction sheet in an editor]' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ {-x+,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \ + '--ignore-date[use current timestamp for author date]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ @@ -1395,6 +1406,8 @@ _git-revert () { '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ ': :__git_commits' @@ -1842,15 +1855,16 @@ _git-tag () { if (( words[(I)-[asu]] )); then message_opts=( - '( -F)-m+[specify tag message]:message' - '(-m )-F+[read tag message from given file]:message file:_files') + '(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message' + '(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files' + ) fi _arguments -A '-*' \ - creation \ - '( -s -u --local-user)-a[create an unsigned, annotated tag]' \ - '(-a -u --local-user)-s[create an signed and annotated tag]' \ - '(-a -s)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ + '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ + '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create an signed and annotated tag]' \ + '(-a --annotate -s --sign)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '-f[replace existing tag]' \ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ $message_opts \ @@ -3129,6 +3143,7 @@ _git-prune () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ + '--progress[show progress]' \ '--expire[only expire loose objects older than given date]: :__git_datetimes' \ '*:: :__git_heads' } @@ -3258,7 +3273,7 @@ _git-remote () { '(--tags )--no-tags[tell git fetch to not import every tag from remote repository]' \ '*'{-t,--track=}'[track given branch instead of default glob refspec]: :__git_branch_names' \ '(-m --master)'{-m,--master=}'[set HEAD of remote to point to given master branch]: :__git_branch_names' \ - '--mirror[do not use separate remotes]' \ + '--mirror[do not use separate remotes]::mirror type:(fetch pull)' \ ':name:__git_remotes' \ ':repository:->repository' && ret=0 case $state in @@ -4786,19 +4801,23 @@ _git-http-backend () { (( $+functions[_git-send-pack] )) || _git-send-pack () { - # TODO: --mirror is undocumented. - # TODO: --stateless-rpc is undocumented. - # TODO: --helper-status is undocumented. _arguments -A '-*' \ + '(-v --verbose)'{-v,--verbose}'[produce verbose output]' \ + '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \ + '--remote[specify remote name]:remote' \ '--all[update all refs that exist locally]' \ - '--dry-run[do everything except actually sending the updates]' \ - '--force[update remote orphaned refs]' \ - '-v[produce verbose output]' \ + '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \ + '--mirror[mirror all refs]' \ + '(-f --force)'{-f,--force}'[update remote orphaned refs]' \ + '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + '(--no-signed --sign)--signed[GPG sign the push]' \ + "(--sign --sign)--no-signed[don't GPG sign the push]" \ '--thin[send a thin pack]' \ - '--mirror[undocumented]' \ - '--stateless-rpc[undocumented]' \ - '--helper-status[undocumented]' \ + '--atomic[request atomic transaction on remote side]' \ + '--stateless-rpc[use stateless RPC protocol]' \ + '--helper-status[print status from remote helper]' \ + '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \ ': :__git_any_repositories' \ '*: :__git_remote_references' } @@ -6746,7 +6765,7 @@ __git_setup_merge_options () { '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' + '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]' '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]' -- cgit v1.2.3 From 8e06a6a28a00adeef8d7b443faaa88138544870a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 27 Jul 2016 14:04:39 +0000 Subject: unposted (after 38939): _git-rebase: Unbreak. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 55d7c8044..15fe53b70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-27 Daniel Shahaf + * unposted (after 38939): Completion/Unix/Command/_git: + _git-rebase: Unbreak. + * 38914 (tweaked): Completion/Unix/Command/_pkg-config: Add options, complete *.pc files for positional arguments. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b54b208fb..71ced8413 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1344,7 +1344,7 @@ _git-rebase () { '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ - '--rerere-autoupdate[allow rerere to update index with resolved conflicts' \ + '--rerere-autoupdate[allow rerere to update index with resolved conflicts]' \ '--no-verify[bypass the pre-rebase hook]' \ '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ -- cgit v1.2.3 From 774f654e364ad19573cefe9f9d4e4919cdaacfd1 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jul 2016 17:00:05 +0000 Subject: 38962: _git-config: Document more line noise. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 970d3e423..bb3c16e1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-31 Daniel Shahaf + * 38962: Completion/Unix/Command/_git: _git-config: Document + more line noise. + * 38959: Doc/Zsh/compsys.yo: Document 38956 (_widgets). 2016-07-29 Daniel Shahaf diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 71ced8413..1952cb651 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2701,11 +2701,16 @@ _git-config () { ;; esac local z=$'\0' + + # Set $parts to the $git_options_static element that corresponds to $line[1] + # (the option name whose value is currently being completed). The elements + # of $parts are the colon-separated elements of the $git_options_static element. declare -a parts parts=("${(S@0)${git_options_static[(r)(#i)${line[1]}:*]}//(#b)(*[^\\]|):/$match[1]$z}") if (( $#parts < 2 )) && [[ $line[1] == [^.]##.*.[^.]## ]]; then parts=("${(S@0)${git_options_static[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}") fi + (( $#parts >= 4 )) || return ret case $parts[4] in ('->'*) -- cgit v1.2.3 From 9ef02744ddb7e17dd6707591e5ec70cd0f0137af Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 30 Jul 2016 17:29:20 +0000 Subject: unposted: _git: Clean up superfluous and missing backslashes. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index b30266ec4..157751eaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-31 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: Clean up superfluous + and missing backslashes. + * 38967: Completion/Unix/Type/_hosts: Don't complete wildcard entries from ~/.ssh/known_hosts. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1952cb651..95995f69b 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1407,7 +1407,7 @@ _git-revert () { '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' + '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ ': :__git_commits' @@ -6767,8 +6767,8 @@ __git_setup_merge_options () { '( --no-squash)--squash[merge, but do not commit]' '(--squash )--no-squash[merge and commit]' '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]' - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' + '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' -- cgit v1.2.3 From 0782e0a0a60ade8ba7c2e7b99d488fcd75663e2c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jul 2016 17:00:06 +0000 Subject: 38961: _git-config: No functional change: rename $git_options_static to $git_options in preparation for the after-next commit. --- ChangeLog | 6 ++++++ Completion/Unix/Command/_git | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 157751eaf..9eaa936b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-08-01 Daniel Shahaf + + * 38961: Completion/Unix/Command/_git: _git-config: No functional + change: rename $git_options_static to $git_options in preparation + for the after-next commit. + 2016-07-31 Daniel Shahaf * unposted: Completion/Unix/Command/_git: Clean up superfluous diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 95995f69b..b23076a1a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1959,8 +1959,8 @@ _git-config () { # TODO: Add support for merge.*. (merge driver), diff.*. (diff driver), and filter.*. (filter driver) options # (see gitattributes(5)). # TODO: .path options should take absolute paths. - declare -a git_options_static - git_options_static=( + declare -a git_options + git_options=( advice.pushNonFastForward:'show advice when git push refuses non-fast-forward refs::->bool:true' advice.pushUpdateRejected:'combined setting for advice.push*::->bool:true' advice.pushNonFFCurrent:'show advice when git push fails due to a non-fast-forward update to the current branch::->bool:true' @@ -2474,10 +2474,10 @@ _git-config () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend - # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.foo.bar'. - options+=(${${${${(M)git_options_static:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) - # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.*.bar'. - options+=(${${${${(M)git_options_static:#(#i)${IPREFIX%%.*}.\*.[^.:]##:*}#(#i)${IPREFIX%%.*}.\*.}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) + # When completing 'remote.foo.', offer 'bar' if $git_options contains 'remote.foo.bar'. + options+=(${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) + # When completing 'remote.foo.', offer 'bar' if $git_options contains 'remote.*.bar'. + options+=(${${${${(M)git_options:#(#i)${IPREFIX%%.*}.\*.[^.:]##:*}#(#i)${IPREFIX%%.*}.\*.}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) declare -a labels labels=( @@ -2511,8 +2511,8 @@ _git-config () { elif compset -P '[^.]##.'; then local opt declare -a match mbegin mend - for opt in ${${${${(M)git_options_static:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do - if (( ${git_options_static[(I)${opt%%:*}.*]} )); then + for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do + if (( ${git_options[(I)${opt%%:*}.*]} )); then sections_and_options+=$opt else options+=$opt @@ -2702,13 +2702,13 @@ _git-config () { esac local z=$'\0' - # Set $parts to the $git_options_static element that corresponds to $line[1] + # Set $parts to the $git_options element that corresponds to $line[1] # (the option name whose value is currently being completed). The elements - # of $parts are the colon-separated elements of the $git_options_static element. + # of $parts are the colon-separated elements of the $git_options element. declare -a parts - parts=("${(S@0)${git_options_static[(r)(#i)${line[1]}:*]}//(#b)(*[^\\]|):/$match[1]$z}") + parts=("${(S@0)${git_options[(r)(#i)${line[1]}:*]}//(#b)(*[^\\]|):/$match[1]$z}") if (( $#parts < 2 )) && [[ $line[1] == [^.]##.*.[^.]## ]]; then - parts=("${(S@0)${git_options_static[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}") + parts=("${(S@0)${git_options[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}") fi (( $#parts >= 4 )) || return ret -- cgit v1.2.3 From b056d8c909a4cf57c45bf9cb9767c90b23369070 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jul 2016 17:00:07 +0000 Subject: 38963: _git-config: Run gettable-options earlier and in all codepaths. No change to completions; this is preparation for the next commit. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 9eaa936b5..9b9dcaa0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-08-01 Daniel Shahaf + * 38963: Completion/Unix/Command/_git: _git-config: Run + gettable-options earlier and in all codepaths. + * 38961: Completion/Unix/Command/_git: _git-config: No functional change: rename $git_options_static to $git_options in preparation for the after-next commit. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b23076a1a..30af6bc07 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2454,6 +2454,11 @@ _git-config () { user.signingkey:'default GPG key to use when creating signed tags::__git_gpg_secret_keys' web.browser:'web browser to use::__git_browsers') + declare -a git_present_options # 'present' is an adjective + git_present_options=( + ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} + ) + case $state in (section) __git_config_sections -b '(|)' '^' section-names 'section name' $* && ret=0 @@ -2663,8 +2668,7 @@ _git-config () { options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' && ret=0 ;; (gettable-option) - _wanted git-options expl option compadd -M 'r:|.=* r:|=*' - \ - ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} && ret=0 + _wanted git-options expl option compadd -M 'r:|.=* r:|=*' -a - git_present_options && ret=0 ;; (gettable-colorbool-option) __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+$' gettable-colorbool-options option && ret=0 -- cgit v1.2.3 From faa163cd5fe9c578e3ed35bd5b10e56b7b357ba7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jul 2016 17:00:08 +0000 Subject: 38964: _git-config: Complete option names present in the config file. This patch lets . git config x.y.z value git config . complete 'x.y.z', even if x.y.z isn't hardcoded into _git-config. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 46 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 9b9dcaa0d..7752ce68b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-08-01 Daniel Shahaf + * 38964: Completion/Unix/Command/_git: _git-config: Complete + option names present in the config file. + * 38963: Completion/Unix/Command/_git: _git-config: Run gettable-options earlier and in all codepaths. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 30af6bc07..b0f8241b2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2459,6 +2459,39 @@ _git-config () { ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} ) + # Add to $git_options options from the config file that aren't already in $git_options. + () { + local -a -U sections_that_permit_arbitrary_subsection_names=( + alias + pager + pretty + remotes + ${(u)${(M)${git_options%%:*}:#*[.][*][.]*}%%.*} + ) + local key + for key in $git_present_options ; do + if (( ${+git_options[(r)(#i)${(b)key}:*]} )); then + # $key is already in git_options + continue + elif (( ${+sections_that_permit_arbitrary_subsection_names[(r)${(b)key%%.*}]} )); then + if [[ $key == *.*.* ]]; then + # If $key isn't an instance of a known foo.*.bar:baz $git_options entry... + if ! (( ${+git_options[(r)(#i)${(b)key%%.*}.[*].${(b)key##*.}:*]} )); then + # ... then add it. + git_options+="${key}:unknown option name" + fi + else + # $key is of the form "foo.bar" where 'foo' is known + # No need to add it; "foo.' will find 'bar' via another codepath later + # ### TODO: that "other codepath" will probably run git config -z again, redundantly. + continue + fi + else + git_options+="${key}:unknown option name" + fi + done + } + case $state in (section) __git_config_sections -b '(|)' '^' section-names 'section name' $* && ret=0 @@ -2539,6 +2572,8 @@ _git-config () { # following functions don't generate any output in the case of # multi-level options. case $IPREFIX in + # Note: If you add a branch to this 'case' statement, + # update $sections_that_permit_arbitrary_subsection_names. (alias.) __git_aliases && ret=0 ;; @@ -2596,6 +2631,10 @@ _git-config () { (svn-remote.) __git_svn-remotes -S . && ret=0 ;; + (*.) + local -a existing_subsections=( ${${${(M)git_present_options:#${IPREFIX}*.*}#${IPREFIX}}%.*} ) + _describe -t existing-subsections "existing subsections" existing_subsections -S . && ret=0 + ;; esac else sections=( @@ -2658,6 +2697,13 @@ _git-config () { web:'web options' svn:'git svn options' svn-remote:'git svn remotes') + () { + local i + for i in ${(u)git_present_options%%.*}; do + (( ${+sections[(r)(#i)${(b)i}:*]} )) || + sections+="${i}:unknown section name" + done + } fi # TODO: Add equivalent of -M 'r:|.=* r:|=*' here so that we can complete -- cgit v1.2.3 From 30aafc0b688eeb2d34a19a215e3919af981a00b5 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 13 Aug 2016 01:37:57 +0200 Subject: 39036: update git completion for new options up to git 2.9.2 --- ChangeLog | 2 + Completion/Unix/Command/_git | 1146 +++++++++++++++++++++++++----------------- 2 files changed, 695 insertions(+), 453 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 3a375a4b3..8612c1c18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-08-13 Oliver Kiddle + * 39036: Completion/Unix/Command/_git: update up to git 2.9.2 + * 39026: Src/Zle/computil.c: pattern specified with _arguments' -A option shouldn't be checked against words after the cursor diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b0f8241b2..78f056435 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -53,7 +53,7 @@ _git-add () { ignore_missing='--ignore-missing[check if files (even missing) are ignored in dry run]' fi - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-n --dry-run)'{-n,--dry-run}'[do not actually add files; only show which ones would be added]' \ '(-v --verbose)'{-v,--verbose}'[show files as they are added]' \ '(-f --force)'{-f,--force}'[allow adding otherwise ignored files]' \ @@ -67,6 +67,7 @@ _git-add () { '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ $ignore_missing \ + '--chmod[override the executable bit of the listed files]:override:(-x +x)' \ '*:: :->file' && return case $state in @@ -101,9 +102,10 @@ _git-am () { _arguments -S \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \ '--keep-non-patch[pass -b to git mailinfo]' \ + '(-m --message-id)'{-m,--message-id}'[pass -m flag to git-mailinfo]' \ '( --no-keep-cr)--keep-cr[pass --keep-cr to git mailsplit]' \ '(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \ '(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \ @@ -150,12 +152,12 @@ _git-archive () { esac fi - _arguments -w -C -S -s \ + _arguments -C -S -s \ '--format=-[format of the resulting archive]:archive format:__git_archive_formats' \ '(- :)'{-l,--list}'[list available archive formats]' \ '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \ '--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \ - '--output=[write archive to argument instead of stdout]:archive:_files' \ + '(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \ '--worktree-attributes[look for attributes in .gitattributes in working directory too]' \ $backend_args \ '--remote=[archive remote repository]:remote repository:__git_any_repositories' \ @@ -190,6 +192,13 @@ _git-bisect () { # subcommand might be removed from the UI level. local curcontext=$curcontext state line ret=1 declare -A opt_args + local good bad + + if good=$(_call_program commands git terms --term-good); then + bad=$(_call_program commands git terms --term-bad) + else + good=( good old ) bad=( new bad ) + fi _arguments -C \ '--help[display git-bisect manual page]' \ @@ -203,15 +212,16 @@ _git-bisect () { commands=( help:'display a short usage description' start:'reset bisection state and start a new bisection' - bad:'mark current or given revision as bad' - good:'mark current or given revision as good' + ${^bad}:'mark current or given revision as bad' + ${^good}:'mark current or given revision as good' skip:'choose a nearby commit' next:'find next bisection to test and check it out' reset:'finish bisection search and return to the given branch (or master)' visualize:'show the remaining revisions in gitk' view:'show the remaining revisions in gitk' replay:'replay a bisection log' - log:'show the log of the current bisection' + terms:'show currently used good/bad terms' + log:'show log of the current bisection' run:'run evaluation script') _describe -t commands command commands && ret=0 @@ -222,6 +232,9 @@ _git-bisect () { case $line[1] in (start) _arguments -C \ + --term-{good,old}'=[specify alternate term for good revisions]:term' \ + --term-{bad,new}'=[specify alternate term for bad revisions]:term' \ + '--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \ ':bad revision:__git_commits' \ '*: :->revision-or-path' && ret=0 case $state in @@ -236,11 +249,11 @@ _git-bisect () { ;; esac ;; - (bad) + (${(j.|.)~good}) _arguments \ ': :__git_commits' && ret=0 ;; - (good|skip) + (${(j.|.)~good}|skip) # TODO: skip can take revlists. _arguments \ '*: :__git_commits' && ret=0 @@ -257,12 +270,15 @@ _git-bisect () { _arguments \ '*:: : _normal' && ret=0 ;; + (terms) + _arguments --term-good --term-bad && ret=0 + ;; (view|visualize) local -a log_options revision_options __git_setup_log_options __git_setup_revision_options - _arguments -w -C -s \ + _arguments -C -s \ $log_options \ $revision_options && ret=0 (*) @@ -279,14 +295,14 @@ _git-bisect () { _git-branch () { declare l c m d e - l='--color --no-color -r -a -v --verbose --abbrev --no-abbrev --list' - c='-l -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --merged --no-merged' + l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort' + c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --merged --no-merged' m='-m --move -M' d='-d --delete -D' e='--edit-description' declare -a dependent_creation_args - if (( words[(I)-r] == 0 )); then + if (( words[(I)(-r|--remotes)] == 0 )); then dependent_creation_args=( "($l $m $d): :__git_branch_names" "::start-point:__git_revisions") @@ -297,7 +313,7 @@ _git-branch () { dependent_creation_args= dependent_deletion_args=( '-r[delete only remote-tracking branches]') - if (( words[(I)-r] )); then + if (( words[(I)(-r|--remotes)] )); then dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names' else dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names' @@ -312,18 +328,18 @@ _git-branch () { '::new branch name:__git_branch_names') fi - _arguments -w -S -s \ + _arguments -S -s \ "($c $m $d $e --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ "($c $m $d $e : --color)--no-color[turn off branch coloring]" \ "($c $m $d $e --no-column)"'--column=[display tag listing in columns]:column.branch option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ "($c $m $d $e --column)"'--no-column[do not display in columns]' \ "($c $m $d $e )*--list[list only branches matching glob]:pattern" \ - "($c $m $e -a)-r[list or delete only remote-tracking branches]" \ - "($c $m $d $e: -r)-a[list both remote-tracking branches and local branches]" \ - "($c $m $d $e : -v -vv --verbose)"{-v,-vv--verbose}'[show SHA1 and commit subject line for each head]' \ + "($c $m $e -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \ + "($c $m $d $e: -r --remotes)-a[list both remote-tracking branches and local branches]" \ + "($c $m $d $e : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \ "($c $m $d $e :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ "($c $m $d $e :)--no-abbrev[do not abbreviate sha1s]" \ - "($l $m $d $e)-l[create the branch's reflog]" \ + "($l $m $d $e)"{-l,--create-reflog}"[create the branch's reflog]" \ "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \ "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \ @@ -331,7 +347,7 @@ _git-branch () { "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ - "($l $m $d $e)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \ + "($l $m $d $e)--no-merged=[don't list branches which are fully contained by HEAD]: :__git_committishs" \ "($c $l $m $d)--edit-description[edit branch description]" \ $dependent_creation_args \ "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \ @@ -340,6 +356,8 @@ _git-branch () { "($l $c $m $d $e)"{-d,--delete}"[delete a fully merged branch]" \ "($l $c $m $d $e)-D[delete a branch]" \ {-q,--quiet}"[be more quiet]" \ + '*--sort=[specify field to sort on]: :__git_ref_sort_keys' \ + '--points-at=[only list tags of the given object]: :__git_commits' \ $dependent_deletion_args } @@ -376,7 +394,7 @@ _git-bundle () { local revision_options __git_setup_revision_options - _arguments -w -S -s \ + _arguments -S -s \ $revision_options \ ': :_files' \ '*: :__git_commit_ranges2' && ret=0 @@ -429,22 +447,24 @@ _git-checkout () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -s \ - '(-q --quiet)'{-q,--quiet}'[suppress feedback messages]' \ + _arguments -C -s \ + '(-q --quiet --progress)'{-q,--quiet}'[suppress progress reporting]' \ '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \ - '(-q --quiet --theirs --patch)--ours[check out stage #2 for unmerged paths]' \ - '(-q --quiet --ours --patch)--theirs[check out stage #3 for unmerged paths]' \ - '( -B --orphan --ours --theirs --conflict --patch --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ - '(-b --orphan --ours --theirs --conflict --patch --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ + '(-q --quiet -2 --ours -3 --theirs --patch)'{-2,--ours}'[check out stage #2 for unmerged paths]' \ + '(-q --quiet -2 --ours -3 --theirs --patch)'{-3,--theirs}'[check out stage #3 for unmerged paths]' \ + '( -B --orphan -2 --ours -3 --theirs --conflict --patch --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ + '(-b --orphan -2 --ours -3 --theirs --conflict --patch --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \ $new_branch_reflog_opt \ '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \ '(-b -B -t --track --patch --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \ - '--ignore-skip-worktree-bits[ignores patterns and adds back any files in ]' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \ '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \ + "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ + "--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \ + '(-q --quiet)--progress[force progress reporting]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -500,15 +520,17 @@ _git-cherry-pick () { '(- :)--quit[end revert or cherry-pick sequence]' \ '(- :)--continue[resume revert or cherry-pick sequence]' \ '(- :)--abort[cancel revert or cherry-pick sequence]' \ + '--allow-empty[preserve initially empty commits]' \ '--allow-empty-message[allow replaying a commit with an empty message]' \ '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \ '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \ '(--ff)-x[append information about what commit was cherry-picked]' \ '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ + '--rerere-autoupdate[update index with reused conflict resolution if possible]' \ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \ '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ @@ -525,12 +547,12 @@ _git-clean () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s \ + _arguments -C -S -s \ '-d[also remove untracked directories]' \ '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \ '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \ - '(-q --quiet)'{-q,--quiet}'[only report errors]' \ + '(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \ '*'{-e+,--exclude=}'[skip files matching specified pattern]:pattern' \ '(-X )-x[also remove ignored files]' \ '( -x)-X[remove only ignored files]' \ @@ -585,11 +607,12 @@ _git-clone () { # TODO: Argument to -o should be a remote name. # TODO: Argument to -b should complete branch names in the repository being # cloned (see __git_references()) - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-l --local --no-local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \ '(-l --local --no-local)--no-local[override --local, as if file:/// URL was given]' \ '--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \ '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \ + '(-j --jobs)'{-j+,--jobs=}'[specify number of submodules cloned in parallel]:jobs' \ '--reference[reference repository]:repository:_directories' \ '--dissociate[make the newly-created repository independent of the --reference repository]' \ '(-q --quiet)'{-q,--quiet}'[operate quietly]' \ @@ -606,8 +629,12 @@ _git-clone () { '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \ '(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \ '(--single-branch)--no-single-branch[clone history leading up to each branch]' \ + '--shallow-submodules[any cloned submodules will be shallow]' \ '--recursive[initialize all contained submodules]' \ + '--recurse-submodules[initialize submodules in the clone]' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ + '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ + '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :->repository' \ ': :_directories' && ret=0 @@ -626,7 +653,7 @@ _git-clone () { (( $+functions[_git-column] )) || _git-column () { - _arguments -w -S -s \ + _arguments -s \ '--command=[look up layout mode using config vars column. and column.ui]' \ '--mode=[specify layout mode. See configuration variable column.ui for option syntax]' \ '--raw-mode=[same as --mode but take mode encoded as a number]' \ @@ -649,14 +676,15 @@ _git-commit () { fi # TODO: --interactive isn't explicitly listed in the documentation. - _arguments -w -S -s \ + _arguments -S -s \ '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \ '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ $reset_author_opt \ - '( --porcelain --dry-run)--short[output dry run in short format]' \ - '(--short --dry-run)--porcelain[output dry run in porcelain-ready format]' \ - '(--short --porcelain --dry-run -z --null)'{-z,--null}'[separate dry run entry output with NUL]' \ + '( --porcelain --dry-run)--short[dry run with short output format]' \ + '--branch[show branch information]' \ + '(--short --dry-run)--porcelain[dry run with machine-readable output format]' \ + '(--short --porcelain --dry-run -z --null)'{-z,--null}'[dry run with NULL-separated output format]' \ {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \ '(--reset-author)--author[override the author name used in the commit]:author name' \ '--date=[override the author date used in the commit]:date' \ @@ -683,7 +711,7 @@ _git-commit () { '( --no-status)--status[include the output of git status in the commit message template]' \ '(--status )--no-status[do not include the output of git status in the commit message template]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '(-a --all --interactive -o --only -i --include *)--interactive[interactively update paths in the index file]' \ $amend_opt \ '*: :__git_ignore_line_inside_arguments __git_changed_files' \ @@ -697,7 +725,7 @@ _git-commit () { (( $+functions[_git-describe] )) || _git-describe () { - _arguments -w -S -s \ + _arguments -S -s \ '(*)--dirty=-[describe HEAD, adding mark if dirty]::mark' \ '--all[use any ref found in "$GIT_DIR/refs/"]' \ '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \ @@ -722,9 +750,10 @@ _git-diff () { __git_setup_diff_options __git_setup_diff_stage_options - _arguments -w -C -s \ + _arguments -C -s \ $* \ $diff_options \ + '(--exit-code)--quiet[disable all output]' $diff_stage_options \ '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ @@ -818,9 +847,10 @@ _git-fetch () { local -a fetch_options __git_setup_fetch_options - _arguments -w -C -S -s \ + _arguments -C -S -s \ $fetch_options \ - '--multiple[allow several repository arguments]' \ + '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' + '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ '*:: :->repository-or-group-or-refspec' && ret=0 case $state in @@ -851,7 +881,7 @@ _git-format-patch () { # TODO: -- is wrong. # TODO: Should filter out --name-only, --name-status, and --check from # $diff_options. - _arguments -w -C -S -s \ + _arguments -C -S -s \ $diff_options \ '--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \ '(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \ @@ -882,9 +912,10 @@ _git-format-patch () { '(--signature --signature-file)--no-signature[do not add a signature]' \ '(--signature --no-signature )--signature-file=[use contents of file as signature]' \ '--suffix=[use the given suffix for filenames]:filename suffix' \ - '--quiet[suppress the output of the names of generated files]' \ + '(-q --quiet)'{-q,--quiet}'[suppress the output of the names of generated files]' \ '--no-binary[do not output contents of changes in binary files, only note that they differ]' \ '--root[treat the revision argument as a range]' \ + '--zero-commit[output all-zero hash in From header]' \ ': :->commit-or-commit-range' && ret=0 case $state in @@ -902,12 +933,12 @@ _git-format-patch () { (( $+functions[_git-gc] )) || _git-gc () { - _arguments -w -S -s \ + _arguments -S -s \ '--aggressive[more aggressively optimize]' \ '--auto[check whether housekeeping is required]' \ '( --no-prune)--prune=[prune loose objects older than given date]: :__git_datetimes' \ '(--prune )--no-prune[do not prune any loose objects]' \ - '--quiet[suppress all progress reports]' + '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' } (( $+functions[_git-grep] )) || @@ -929,9 +960,9 @@ _git-grep () { _arguments -C -A '-*' \ '(-O --open-files-in-pager --no-index)--cached[search blobs registered in index file instead of working tree]' \ '(--cached)--no-index[search files in current directory, not just tracked files]' \ - '(--exclude-standard)--no-exclude-standard[also search in ignored files]' \ + '(--exclude-standard)--no-exclude-standard[search also in ignored files]' \ '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \ - '--untracked[search in untracked files]' \ + '--untracked[search also in untracked files]' \ '(-a --text)'{-a,--text}'[process binary files as if they were text]' \ '(--textconv --no-textconv)--textconv[honor textconv filter settings]' \ '(--textconv --no-textconv)--no-textconv[do not honor textconv filter settings]' \ @@ -960,6 +991,7 @@ _git-grep () { '(-A --after-context)'{-A+,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ '(-B --before-context)'{-B+,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '--threads=[use specified number of threads]:threads' \ '(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ '(1)*-f+[read patterns from given file]:pattern file:_files' \ @@ -1070,7 +1102,7 @@ _git-gui () { (( $+functions[_git-init] )) || _git-init () { - _arguments -w -S -s \ + _arguments -S -s \ '(-q --quiet)'{-q,--quiet}'[do not print any results to stdout]' \ '--bare[create a bare repository]' \ '--template=[directory to use as a template for the object database]: :_directories' \ @@ -1088,10 +1120,9 @@ _git-log () { __git_setup_log_options __git_setup_revision_options - _arguments -w -C -s \ + _arguments -C -s \ $log_options \ $revision_options \ - '-L+[trace the evolution of a line range or regex within a file]:range' \ '(-)--[start file arguments]' \ '1: :->first-commit-ranges-or-files' \ '*: :->commit-ranges-or-files' && ret=0 @@ -1134,12 +1165,14 @@ _git-merge () { __git_setup_merge_options local -a git_commit_opts=(--all --not HEAD --not) - _arguments -w -S -s \ + _arguments -S -s \ $merge_options \ '-m+[set the commit message to be used for the merge commit]:merge message' \ + '(--edit --no-edit)-e[open an editor to change the commit message]' \ '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ + '--progress[force progress reporting]' \ '*: : __git_commits -O expl:git_commit_opts' } @@ -1148,7 +1181,7 @@ _git-mv () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ @@ -1190,7 +1223,9 @@ _git-notes () { merge:'merge the given notes ref into the current ref' show:'show notes for a given object' remove:'remove notes for a given object' - prune:'remove all notes for non-existing/unreachable objects') + prune:'remove all notes for non-existing/unreachable objects' + get-ref:'print the current notes ref' + ) _describe -t commands command commands && ret=0 ;; @@ -1198,14 +1233,14 @@ _git-notes () { curcontext=${curcontext%:*}-$line[1]: case $line[1] in - (list|show|edit|remove) + (list|show) _arguments \ ': :__git_commits' && ret=0 ;; (add) # TODO: Only complete commits that don't have notes already, unless # -f or --force has been given. - _arguments -w -S -s \ + _arguments -S -s \ '*'{-m+,--message=}'[use given note message]:message' \ '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ @@ -1215,24 +1250,35 @@ _git-notes () { ;; (copy) # TODO: --for-rewrite is undocumented. - _arguments -w -S -s \ + _arguments -S -s \ '(-f --force)'{-f,--force}'[replace existing note]' \ '(:)--stdin[read objects from stdin]' \ '(:--stdin)--for-rewrite=[load rewriting config for given command]:command:(amend rebase)' \ ': :__git_commits' \ ': :__git_commits' && ret=0 ;; + (edit) + _arguments --allow-empty ':object:__git_commits' && ret=0 + ;; (merge) - _arguments -w -S -s \ + _arguments -S -s \ '(-s --strategy)--abort[abort an in-progress notes merge]' \ '(-s --strategy)--commit[finalize an in-progress notes merge]' \ - {-q,--quiet}'[be quiet]' \ - {-v,--verbose}'[be more verbose]' \ + '(-q --quiet)'{-q,--quiet}'[be quiet]' \ + '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ '(--abort --commit)'{-s,--strategy=}'[resolve conflicts using the given strategy]' \ ': :__git_notes_refs' && ret=0 ;; + (prune) + _arguments -s \ + '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ + '(-n --dry-run)'{-n,--dry-run}"[don't remove anything, just report what would be deleted]" && ret=0 + ;; + (remove) + _arguments --ignore-missing --stdin ':object:__git_commits' && ret=0 + ;; (append) - _arguments -w -S -s \ + _arguments -S -s \ '*'{-m+,--message=}'[use given note message]:message' \ '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ @@ -1259,9 +1305,12 @@ _git-pull () { $merge_options \ '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((true\:"rebase after fetching" false\:"merge after fetching" - preserve\:"rebase and preserve merges"))' \ + preserve\:"rebase and preserve merges" + interactive\:"allow list of commits to be edited"))' \ '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ + '--autostash[automatically stash/stash pop before and after rebase]' \ $fetch_options \ + '(--no-tags -t --tags)--no-tags[disable automatic tag following]' \ ': :__git_any_repositories' \ '*: :__git_ref_specs_fetchy' } @@ -1269,11 +1318,17 @@ _git-pull () { (( $+functions[_git-push] )) || _git-push () { local ret=1 + local -a sign + sign=( + {yes,true}'\:always,\ and\ fail\ if\ unsupported\ by\ server' + {no,false}'\:never' + if-asked'\:iff\ supported\ by\ server' + ) # NOTE: For --receive-pack we use _files to complete, even though this will # only complete files on the local end, not the remote end. Still, it may be # helpful to get some sort of completion going, perhaps modifying the path # later on to match the remote end. - _arguments -w -S -s \ + _arguments -S -s \ '--all[push all refs under refs/heads/]' \ '--prune[remove remote branches that do not have a local counterpart]' \ '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \ @@ -1293,12 +1348,14 @@ _git-push () { '(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' \ '(-q --quiet)--progress[output progress information]' \ - '(--verify)--no-verify[bybass the pre-push hook]' \ - '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" - on-demand\:"push all changed submodules"))' \ - '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + '(--verify)--no-verify[bypass the pre-push hook]' \ + '--recurse-submodules=[submodule handling]:submodule handling:(( + check\:"refuse to push if submodule commit not to be found on remote" + on-demand\:"push all changed submodules" + no\:"no submodule handling"))' \ + "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \ '(--no-signed --sign)--signed[GPG sign the push]' \ - "(--sign --sign)--no-signed[don't GPG sign the push]" \ + "(--sign --signed)--no-signed[don't GPG sign the push]" \ '--atomic[request atomic transaction on remote side]' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ @@ -1336,10 +1393,9 @@ _git-rebase () { '(-)--edit-todo[edit interactive instruction sheet in an editor]' \ '(-)--skip[skip the current patch]' \ - options \ - "--keep-empty[keep empty commits in the result]" \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ @@ -1354,10 +1410,12 @@ _git-rebase () { '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ {-x+,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ + '(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \ + '--fork-point[use merge-base --fork-point to refine upstream]' \ '--ignore-date[use current timestamp for author date]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ @@ -1370,16 +1428,15 @@ _git-reset () { local curcontext=$curcontext state line ret=1 typeset -A opt_args - _arguments -w -C -s \ + _arguments -C -s -S \ '( --mixed --hard --merge --keep -p --patch -- *)--soft[do not touch the index file nor the working tree]' \ '(--soft --hard --merge --keep -p --patch -- *)--mixed[reset the index but not the working tree (default)]' \ - '(--soft --hard --merge --keep -p --patch -- *)-N[keep --intent-to-add entries in the index]' \ + '(--soft --hard --merge --keep -p --patch -- *)'{-N,--intent-to-add}'[record only the fact that removed paths will be added later]' \ '(--soft --mixed --merge --keep -p --patch -- *)--hard[match the working tree and index to the given tree]' \ '(--soft --mixed --hard --keep -p --patch -- *)--merge[reset out of a conflicted merge]' \ '(--soft --mixed --hard --merge -p --patch -- *)--keep[like --hard, but keep local working tree changes]' \ '(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ - '(- 1)--[start file arguments]' \ '(--soft --mixed --hard --merge --keep):: :__git_commits' \ '(--soft --mixed --hard --merge --keep)*:: :->file' && ret=0 @@ -1397,19 +1454,20 @@ _git-reset () { (( $+functions[_git-revert] )) || _git-revert () { - _arguments -w -S -s \ + _arguments -S -s \ '(- :)--quit[end revert or cherry-pick sequence]' \ '(- :)--continue[resume revert or cherry-pick sequence]' \ '(- :)--abort[cancel revert or cherry-pick sequence]' \ '(-e --edit --no-edit)'{-e,--edit}'[edit the commit before committing the revert]' \ '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing the revert]' \ '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ + '--rerere-autoupdate[update the index with reused conflict resolution if possible]' \ '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ ': :__git_commits' } @@ -1418,13 +1476,13 @@ _git-rm () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-f --force)'{-f,--force}'[override the up-to-date check]' \ '(-n --dry-run)'{-n,--dry-run}'[do not actually remove the files, just show if they exist in the index]' \ '-r[allow recursive removal when a leading directory-name is given]' \ '--cached[only remove files from the index]' \ '--ignore-unmatch[exit with 0 status even if no files matched]' \ - '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ + '(-q --quiet)'{-q,--quiet}"[don't list removed files]" \ '*:: :->file' && ret=0 case $state in @@ -1446,7 +1504,7 @@ _git-shortlog () { # TODO: should take all arguments found in setup_revisions() (probably more # or less what git-rev-list takes). - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(: -)'{-h,--help}'[print a short usage message and exit]' \ '(-n --numbered)'{-n,--numbered}'[sort according to number of commits]' \ '(-s --summary)'{-s,--summary}'[suppress commit description]' \ @@ -1508,9 +1566,10 @@ _git-show () { __git_setup_log_options __git_setup_revision_options - _arguments -w -C -s \ + _arguments -C -s \ $log_options \ $revision_options \ + '(-q --quiet)'{-q,--quiet}'[suppress diff output]' \ '*:: :->object' && ret=0 case $state in @@ -1530,15 +1589,24 @@ _git-show () { _git-stash () { local curcontext=$curcontext state line ret=1 declare -A opt_args + local -a save_arguments + + save_arguments=( + '(-p --patch -a --all -u --include-untracked)'{-p,--patch}'[interactively select hunks from diff between HEAD and working tree to stash]' + '(-k --keep-index --no-keep-index)'{-k,--keep-index}'[all changes already added to the index are left intact]' + '(-k --keep-index)--no-keep-index[all changes already added to the index are undone]' + '(-q --quiet)'{-q,--quiet}'[suppress all output]' + '(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]' + '(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]' + ) _arguments -C \ - ': :->command' \ - '*:: :->option-or-argument' && ret=0 + '*::: :->args' \ + ${save_arguments//#\(/(* } && ret=0 - case $state in - (command) + if [[ -n $state ]]; then + if (( CURRENT == 1 )); then local -a commands - local -a save_arguments commands=( save:'save your local modifications to a new stash' @@ -1549,24 +1617,16 @@ _git-stash () { branch:'branch off at the commit at which the stash was originally created' clear:'remove all the stashed states' drop:'remove a single stashed state from the stash list' - create:'create a stash without storing it in the ref namespace') - - save_arguments=( - '(--keep-index)--patch[interactively select hunks from diff between HEAD and working tree to stash]' \ - '( --no-keep-index)--keep-index[all changes already added to the index are left intact]' \ - '(--keep-index )--no-keep-index[all changes already added to the index are undone]' \ - '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ - '(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \ + create:'create a stash without storing it in the ref namespace' ) + _describe -t commands command commands && ret=0 - _arguments -S $save_arguments && ret=0 # "stash" defaults to "save", but without "message". - ;; - (option-or-argument) + else curcontext=${curcontext%:*}-$line[1]: + compset -n 1 case $line[1] in (save) - _arguments -S $save_arguments && ret=0 _arguments -S \ $save_arguments \ ':: :_guard "([^-]?#|)" message' && ret=0 @@ -1576,7 +1636,7 @@ _git-stash () { __git_setup_log_options __git_setup_revision_options - _arguments -s -w \ + _arguments -s \ $log_options \ $revision_options && ret=0 ;; @@ -1584,7 +1644,7 @@ _git-stash () { local diff_options __git_setup_diff_options - _arguments -S -s -w \ + _arguments -S -s \ $diff_options \ ':: :__git_stashes' && ret=0 ;; @@ -1614,8 +1674,8 @@ _git-stash () { _nothing ;; esac - ;; - esac + fi + fi return ret } @@ -1628,8 +1688,8 @@ _git-status () { branch_opts=('(-b --branch)'{-b,--branch}'[show branch and tracking info]') fi - _arguments -w -S -s \ - '(-s --short)'{-s,--short}'[output in short format]' \ + _arguments -S -s \ + '(-s --short --column --no-column)'{-s,--short}'[output in short format]' \ $branch_opts \ '(-s --short)--porcelain[produce machine-readable output]' \ '(-u --untracked-files)'{-u-,--untracked-files=-}'[show untracked files]::mode:((no\:"show no untracked files" \ @@ -1637,8 +1697,8 @@ _git-status () { all\:"also show untracked files in untracked directories (default)"))' \ '--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \ '--ignored[show ignored files as well]' \ - '(--porcelain)-z[use NUL termination on output]' \ - '(--no-column)--column=-[display in columns]::column.status option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ + '(-z --null --column --no-column)'{-z,--null}'[use NUL termination on output]' \ + '(--no-column -z --null)--column=-[display in columns]::column.status option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ '(--column)--no-column[do not display in columns]' \ '*: :__git_ignore_line_inside_arguments _files' } @@ -1700,6 +1760,7 @@ _git-submodule () { (deinit) _arguments -S \ '(-f --force)'{-f,--force}'[remove submodule worktree even if local modifications are present]' \ + '(*)--all[remove all submodules]' \ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0 ;; (update) @@ -1707,8 +1768,9 @@ _git-submodule () { _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ '(-N --no-fetch)'{-N,--no-fetch}'[do not fetch new objects from repository]' \ - '--merge[merge commit recorded in superproject into current branch of submodule]' \ - '--rebase[rebase current branch onto commit recorded in superproject]' \ + '(--merge --rebase)--checkout[checkout commit recorded in the superproject in the submodule on a detached HEAD]' \ + '(--checkout --rebase)--merge[merge commit recorded in superproject into current branch of submodule]' \ + '(--checkout --merge)--rebase[rebase current branch onto commit recorded in superproject]' \ '--reference=[remote repository to clone]: :__git_any_repositories' \ '--recursive[traverse submodules recursively]' \ '--remote[use the status of the submodule''s remote-tracking branch]' \ @@ -1719,8 +1781,8 @@ _git-submodule () { (summary) _arguments -C -A '-*' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ - '--cached[use commit stored in the index]' \ - '--files[compare commit in index with submodule HEAD commit]' \ + '(--files)--cached[use commit stored in the index]' \ + '(--cached)--files[compare commit in index with submodule HEAD commit]' \ '(-n --summary-limit)'{-n,--summary-limit=}'[limit summary size]: :__git_guard_number "limit"' \ '(-)--[start submodule arguments]' \ '*:: :->commit-or-submodule' && ret=0 @@ -1829,14 +1891,15 @@ _git-subtree () { ;; (split) _arguments -S \ + '--annotate[add a prefix to commit message of new commits]:prefix' \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-P --prefix)'{-P+,--prefix=}'[specify path to the subtree in the repository to manipulate]: :_directories' \ '(-b --branch)'{-b,--branch=}'[create a new branch]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ - '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ + '(-m --message)'{-m+,--message=}'[specify commit message for the merge]:message' \ '--ignore-joins[ignore prior --rejoin commits]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ - '--rejoin[use the given message as the commit message for the merge commit]' \ + '--rejoin[merge the new branch back into HEAD]' \ '*: :__git_references' && ret=0 ;; (*) @@ -1865,13 +1928,14 @@ _git-tag () { '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create an signed and annotated tag]' \ '(-a --annotate -s --sign)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ - '-f[replace existing tag]' \ + '(-f --force)'{-f,--force}'[replace existing tag]' \ + '--create-reflog[create a reflog]' \ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ $message_opts \ ': :__git_tags' \ ':: :__git_commits' \ - deletion \ - '-d[delete tags]' \ + '(-d --delete)'{-d,--delete}'[delete tags]' \ '*:: :__git_ignore_line_inside_arguments __git_tags' \ - listing \ '-n+[limit line output of annotation]: :__git_guard_number "limit"' \ @@ -1879,15 +1943,70 @@ _git-tag () { '(--no-column)--column=-[display tag listing in columns]::column.tag option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ '(--column)--no-column[do not display in columns]' \ '--contains=[only list tags which contain the specified commit]: :__git_commits' \ - '--points-at=[only list tags of the given object]: :__git_commits' \ + '--merged=-[print only tags that are merged]:: :__git_commits' \ + '--no-merged=-[print only tags that are not merged]:: :__git_commits' \ '--sort=[specify how the tags should be sorted]:mode:((refname\:"lexicographic order" version\\\:refname\:"tag names are treated as version numbers"))' \ + '--points-at=[only list tags of the given object]: :__git_commits' \ + '--format=[specify format to use for the output]' \ '::pattern' \ - verification \ - '-v[verifies gpg signutare of tags]' \ + '(-v --verify)'{-v,--verify}'[verify gpg signutare of tags]' \ '*:: :__git_ignore_line_inside_arguments __git_tags' } +(( $+functions[_git-worktree] )) || +_git-worktree() { + local curcontext="$curcontext" state state_descr line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands args + + commands=( + add:'create a new working tree' + prune:'prune working tree information' + list:'list details of each worktree' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (add) + if (( $words[(I)--detach] )); then + args=( ':commit:__git_commits' ) + else + args=( ':branch:__git_branch_names' ) + fi + _arguments \ + '(-f --force)'{-f,--force}'[checkout branch even if already checked out in another worktree]' \ + '(-B --detach)-b+[create a new branch]: :__git_branch_names' \ + '(-b --detach)-B+[create or reset a branch]: :__git_branch_names' \ + '(-b -B)--detach[detach HEAD at named commit]' \ + ':path:_files' $args && ret=0 + ;; + (prune) + _arguments \ + '(-n --dry-run)'{-n,--dry-run}"[don't remove, show only]" \ + '(-v --verbose)'{-v,--verbose}'[report pruned objects]' \ + '--expire[expire objects older than specified time]:time' && ret=0 + ;; + (list) + _arguments '--porcelain[machine-readable output]' && ret=0 + ;; + esac + ;; + esac + return ret +} + (( $+functions[_gitk] )) || _gitk () { _git-log @@ -1926,35 +2045,39 @@ _git-config () { value_arg=': :->value' fi - _arguments -w -C -S -s \ - '( --system --local -f --file)--global[use user-global config file]' \ - '(--global --local -f --file)--system[use system-wide config file]' \ - '(--global --system -f --file)--local[use local config file]' \ - '(--global --system -f --file)'{-f+,--file=}'[use given config file]:config file:_files' \ + _arguments -C -S -s \ + '( --system --local -f --file --blob)--global[use user-global config file]' \ + '(--global --local -f --file --blob)--system[use system-wide config file]' \ + '(--global --system -f --file --blob)--local[use local config file]' \ + '(--global --system --local --blob)'{-f+,--file=}'[use given config file]:config file:_files' \ + '(--global --system --local -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \ '( --int --bool-or-int --path)--bool[setting is a boolean]' \ '(--bool --bool-or-int --path)--int[setting is an integer]' \ '(--bool --int --path)--bool-or-int[setting is an integer]' \ '(--bool --int --bool-or-int )--path[setting is a path]' \ '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \ + '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \ + '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \ + '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \ + '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \ $name_arg \ $value_arg \ '::value regex' \ - '(actions)' \ - '(-z --null)--replace-all[replace all values of the given key]' \ - '(3 -z --null)--add[add new value without altering any existing ones]' \ - '(2)--get[get the first matching value of the key]' \ - '(2)--get-all[get all matching values of the key]' \ - '(3 --bool --int --bool-or-int --path -z --null)--remove-section[remove the given section]' \ - '(3 --bool --int --bool-or-int --path -z --null)--rename-section[rename the given section]' \ - '(2 --bool --int --bool-or-int --path -z --null)--unset[remove the first matching value of the key]' \ - '(2 --bool --int --bool-or-int --path -z --null)--unset-all[remove all matching values of the key]' \ - '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \ + '(2 --name-only)--get[get the first matching value of the key]' \ + '(2 --name-only)--get-all[get all matching values of the key]' \ '(2)--get-regexp[like "--get-all", but interpret "name" as a regular expression]' \ - '(2 3 --bool --int --bool-or-int --path -z --null)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' \ - '(2 3 --bool --int --bool-or-int --path -z --null)--get-color[find color setting]: :->gettable-color-option' \ - '(-e --edit --bool --int --bool-or-int --path -z --null)'{-e,--edit}'[open config file for editing]' \ - '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \ - '(--includes)'--no-includes'[do not respect "include.*" directives]' && ret=0 + '(--name-only --show-origin)--get-urlmatch[get value specific for the URL]' \ + '(-z --null --name-only --show-origin)--replace-all[replace all values of the given key]' \ + '(3 -z --null --name-only --show-origin)--add[add new value without altering any existing ones]' \ + '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \ + '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \ + '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \ + '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \ + '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \ + '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ + '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ + '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 # TODO: Add support for merge.*. (merge driver), diff.*. (diff driver), and filter.*. (filter driver) options # (see gitattributes(5)). @@ -3107,7 +3230,7 @@ _git-config () { (( $+functions[_git-fast-export] )) || _git-fast-export () { # TODO: * should be git-rev-arg and git-rev-list arguments. - _arguments -w -S -s \ + _arguments -S -s \ '--progress=[insert progress statements]: :__git_guard_number interval' \ '--signed-tags=[specify how to handle signed tags]:action:((verbatim\:"silently export" warn\:"export, but warn" @@ -3126,6 +3249,9 @@ _git-fast-export () { '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \ '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \ '--full-tree[output full tree for each commit]' \ + '(--get --get-all)--name-only[show variable names only]' \ + '*--refspec=[apply refspec to exported refs]:refspec' \ + '--anonymize[anonymize output]' \ '*: :__git_commit_ranges' } @@ -3138,8 +3264,8 @@ _git-fast-import () { now\:"use current time and timezone"' \ '--done[terminate with error if there is no "done" command at the end of the stream]' \ '--force[force updating modified existing branches]' \ - '--max-pack-size=-[maximum size of each packfile]: :__git_guard_bytes' \ - '--big-file-threshold=-[maximum size of blob to create deltas for]: :__git_guard_bytes' \ + '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes' \ + '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes' \ '--depth=-[maximum delta depth for blob and tree deltification]: :__git_guard_number "maximum delta depth"' \ '--active-branches=-[maximum number of branches to maintain active at once]: :__git_guard_number "maximum number of branches"' \ '--export-marks=-[dump internal marks table when complete]: :_files' \ @@ -3199,7 +3325,7 @@ _git-prune () { '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ '--progress[show progress]' \ - '--expire[only expire loose objects older than given date]: :__git_datetimes' \ + '--expire=[only expire loose objects older than specified date]: :__git_datetimes' \ '*:: :__git_heads' } @@ -3230,7 +3356,9 @@ _git-reflog () { commands=( 'expire:prune old reflog entries' 'delete:delete entries from reflog' - 'show:show log of ref') + 'show:show log of ref' + 'exists:check whether a ref has a reflog' + ) _alternative \ 'commands:: _describe -t commands command commands' \ @@ -3258,6 +3386,7 @@ _git-reflog () { '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \ '--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \ '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \ + '--verbose[output additional information]' \ '*:: :->reflog-entry' && ret=0 case $state in @@ -3272,6 +3401,9 @@ _git-reflog () { $revision_options \ ':: :__git_references' && ret=0 ;; + (exists) + __git_references && ret=0 + ;; esac esac @@ -3305,14 +3437,16 @@ _git-remote () { commands=( 'add:add a new remote' + 'get-url:retrieves the URLs for a remote' 'rename:rename a remote and update all associated tracking branches' - 'rm:remove a remote and all associated tracking branches' + {rm,remove}':remove a remote and all associated tracking branches' 'set-head:set or delete default branch for a remote' 'set-branches:change list of branches tracked by a remote' 'set-url:change URL for a remote' 'show:show information about a given remote' 'prune:delete all stale tracking branches for a remote' - 'update:fetch updates for a set of remotes') + 'update:fetch updates for a set of remotes' + ) _describe -t commands command commands && ret=0 ;; @@ -3322,7 +3456,7 @@ _git-remote () { case $line[1] in (add) # TODO: -t and --track should really list branches at url. - _arguments -w -S -s \ + _arguments -S -s \ '(-f --fetch)'{-f,--fetch}'[run git fetch on new remote after it has been created]' \ '( --no-tags)--tags[tell git fetch to import every tag from remote repository]' \ '(--tags )--no-tags[tell git fetch to not import every tag from remote repository]' \ @@ -3340,18 +3474,20 @@ _git-remote () { ;; esac ;; + (get-url) + _arguments -S -s \ + '--push[list push URL instead of fetch URL]' \ + '--all[list all URLs for the remote]' \ + ': :__git_remotes' && ret=0 + ;; (rename) _arguments \ ':old name:__git_remotes' \ ':new name:__git_remotes' && ret=0 ;; - (rm) - _arguments \ - ': :__git_remotes' && ret=0 - ;; (set-head) # TODO: Second argument should be a branch at url for remote. - _arguments -w -S -s \ + _arguments -S -s \ '(- 2)'{-d,--delete}'[delete default branch]' \ '(- 2)'{-a,--auto}'[determine default branch automatically]' \ ': :__git_remotes' \ @@ -3359,14 +3495,14 @@ _git-remote () { ;; (set-branches) # TODO: Branches should be at url. - _arguments -w -S -s \ + _arguments -S -s \ '--add[add branches to those already defined]' \ ': :__git_remotes' \ '*: :__git_branch_names' && ret=0 ;; (set-url) # TODO: Old URL should be one of those defined for the remote. - _arguments -w -S -s \ + _arguments -S -s \ '(3)--push[manipulate push URLs instead of fetch URLs]' \ '--add[add URL to those already defined]' \ '(3)--delete[delete all matching URLs]' \ @@ -3375,20 +3511,23 @@ _git-remote () { ':old url:_urls' && ret=0 ;; (show) - _arguments -w -S -s \ + _arguments -S \ '-n[do not contact the remote for a list of branches]' \ '*: :__git_remotes' && ret=0 ;; (prune) - _arguments -w -S -s \ + _arguments -S -s \ '(-n --dry-run)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \ '*: :__git_remotes' && ret=0 ;; (update) - _arguments -w -S -s \ + _arguments -S -s \ '(-p --prune)'{-p,--prune}'[prune all updated remotes]' \ ': :__git_remote-groups' && ret=0 ;; + (*) # rm, remove and fallback for any new subcommands + __git_remotes && ret=0 + ;; esac ;; esac @@ -3399,32 +3538,39 @@ _git-remote () { (( $+functions[_git-repack] )) || _git-repack () { # TODO: --quiet is undocumented. - _arguments -w -S -s \ + _arguments -s \ '(-A)-a[pack all objects into a single pack]' \ '(-a)-A[pack all objects into a single pack, but unreachable objects become loose]' \ '-d[remove redundant packs after packing]' \ - '-l[pass --local option to git pack-objects]' \ + "--unpack-unreachable=[with -A, don't loosen objects older than specified date]:date" \ '-f[pass --no-reuse-delta option to git pack-objects]' \ '-F[pass --no-reuse-object option to git pack-objects]' \ + "-n[don't update server information]" \ '(-q --quiet)'{-q,--quiet}'[pass -q option to git pack-objects]' \ - '-n[do not update server information]' \ - '--window=-[number of objects to consider when doing delta compression]: :__git_guard_number "number of objects"' \ - '--depth=-[maximum delta depth]: :__git_guard_number "maximum delta depth"' \ - '--window-memory=-[scale window size dynamically to not use more than N bytes of memory]: :__git_guard_bytes' \ - '--max-pack-size=-[maximum size of each output packfile]:maximum pack size:__git_guard_bytes' + '(-l --local)'{-l,--local}'[pass --local option to git pack-objects]' \ + '(-b --write-bitmap-index)'{-b,--write-bitmap-index}'[write a bitmap index]' \ + "--unpack-unreachable=[with -A, don't loosen objects older than specified time]:time" \ + '--window=[number of objects to consider when doing delta compression]:number of objects' \ + '--window-memory=[scale window size dynamically to not use more than specified amount of memory]: : __git_guard_bytes' \ + '--depth=[maximum delta depth]:maximum delta depth' \ + '--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \ + '--pack-kept-objects[repack objects in packs marked with .keep]' } (( $+functions[_git-replace] )) || _git-replace () { - _arguments -w -S -s \ - '--edit[edit existing object as base a starting point]' \ - '--graft[rewrite the parents of a commit]' \ - '(- *)-f[overwrite existing replace ref]' \ - '(- 2)-d[delete existing replace refs]' \ - '(- : *)-l[list replace refs]:pattern' \ + _arguments -S -s \ + '(-d --delete -l --list -g --graft *)'{-f,--force}'[overwrite existing replace ref]' \ + "(-d --delete -l --list -g --graft 2 *)--raw[don't pretty-print contents for --edit]" \ + '(-d --delete -e --edit -g --graft --raw)--format=[use specified format]:format:(short medium long)' \ ': :__git_objects' \ ':replacement:__git_objects' \ - '*: :__git_objects' + '*: :__git_objects' \ + - '(actions)' \ + '(: * --raw -f --force)'{-l,--list}'[list replace refs]:pattern' \ + {-d,--delete}'[delete existing replace refs]:*:replacement:__git_objects' \ + '(* 2 --format)'{-e,--edit}'[edit existing object and replace it with the new one]' \ + '(--raw --format)'{-g,--graft}'[rewrite the parents of a commit]' } # Ancillary Commands (Interrogators) @@ -3438,10 +3584,11 @@ _git-blame () { __git_setup_revision_options # TODO: Not sure about __git_cached_files. - _arguments -w -C -S -s \ + _arguments -C -S -s \ '-b[show blank SHA-1 for boundary commits]' \ '--root[do not treat root commits as boundaries]' \ '--show-stats[include additional statistics at the end of blame output]' \ + '--progress[force progress reporting]' \ '*-L[annotate only the given line range]: :->line-range' \ '-l[show long rev]' \ '-t[show raw timestamp]' \ @@ -3496,7 +3643,7 @@ _git-cherry () { _git-count-objects () { _arguments \ '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]' \ - {-H,--human-readable}'[Print sizes in human readable format]' + {-H,--human-readable}'[print sizes in human readable format]' } (( $+functions[_git-difftool] )) || @@ -3517,7 +3664,7 @@ _git-difftool () { (( $+functions[_git-fsck] )) || _git-fsck () { # TODO: -v is undocumented. - _arguments -w -S -s \ + _arguments -S -s \ '--unreachable[show objects that are unreferenced in the object database]' \ '(--dangling --no-dangling)--dangling[print dangling objects (default)]' \ '(--dangling --no-dangling)--no-dangling[do not print dangling objects]' \ @@ -3526,9 +3673,11 @@ _git-fsck () { '--cache[consider objects recorded in the index as head nodes for reachability traces]' \ '--no-reflogs[do not consider commits referenced only by reflog entries to be reachable]' \ '--full[check all object directories]' \ + '--connectivity-only[check only connectivity]' \ '--strict[do strict checking]' \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '--lost-found[write dangling objects into .git/lost-found]' \ + '--progress[show progress]' \ '*: :__git_objects' } @@ -3539,13 +3688,13 @@ _git-get-tar-commit-id () { (( $+functions[_git-help] )) || _git-help () { - _arguments -w -S -s \ + _arguments -S -s \ '( -g --guides -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \ '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[show all available commands]' \ '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[show all available commands]' \ '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[show all available commands]' \ '(-g --guides)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ - ': :_git_commands' + ': : _alternative commands:command:_git_commands "guides:git guides:(attributes glossary ignore modules revisions tutorial workflows)"' } (( $+functions[_git-instaweb] )) || @@ -3553,7 +3702,7 @@ _git-instaweb () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-l --local)'{-l,--local}'[bind the web server to 127.0.0.1]' \ '(-d --httpd)'{-d,--httpd=}'[HTTP-daemon command-line that will be executed]:command line' \ '(-m --module-path)'{-m,--module-path=}'[module path for the Apache HTTP-daemon]:module path:_directories' \ @@ -3594,7 +3743,7 @@ _git-rerere () { declare -A opt_args # TODO: --rerere-autoupdate is undocumented. - _arguments -w -C -S -s \ + _arguments -C -S -s \ '--rerere-autoupdate[register clean resolutions in index]' \ ': :->command' && ret=0 @@ -3636,7 +3785,7 @@ _git-rev-parse () { _message 'argument' else # TODO: Parse option specification? - _arguments -w -S -s \ + _arguments -S -s \ '(- *)'{-h,--help}'[display usage]' \ '--keep-dashdash[do not skip first -- option]' \ '--stop-at-non-option[stop parsing options at first non-option argument]' \ @@ -3693,7 +3842,7 @@ _git-show-branch () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s -A '-*' \ + _arguments -C -S -s -A '-*' \ '(--more --merge-base --independent)--list[do not show any ancestry (--more=-1)]' \ - branches \ '(-r --remotes -a --all)'{-r,--remotes}'[show remote-tracking branches]' \ @@ -3732,15 +3881,17 @@ _git-show-branch () { (( $+functions[_git-verify-commit] )) || _git-verify-commit () { - _arguments -w -S -s \ - '(-v --verbose)'{-v,--verbose}'[print the contents of the commit object before validating it]' \ + _arguments -S -s \ + '(-v --verbose)'{-v,--verbose}'[print contents of the commit object before validating it]' \ + '--raw[print raw gpg status output]' \ '*: :__git_commits' } (( $+functions[_git-verify-tag] )) || _git-verify-tag () { - _arguments -w -S -s \ - '(-v --verbose)'{-v,--verbose}'[print the contents of the tag object before validating it]' \ + _arguments -S -s \ + '(-v --verbose)'{-v,--verbose}'[print contents of the tag object before validating it]' \ + '--raw[print raw gpg status output]' \ '*: :__git_tags' } @@ -3823,7 +3974,7 @@ _git-cvsimport () { (( $+functions[_git-cvsserver] )) || _git-cvsserver () { - _arguments -w -S -s \ + _arguments -S -s \ '--base-path[path to prepend to requested CVSROOT]: :_directories' \ '--strict-paths[do not allow recursing into subdirectories]' \ '--export-all[do not check for gitcvs.enabled]' \ @@ -3835,7 +3986,11 @@ _git-cvsserver () { (( $+functions[_git-imap-send] )) || _git-imap-send () { - _message 'no arguments allowed; accepts mailbox file on standard input' + _arguments \ + '--curl[use libcurl to communicate with the IMAP server]' \ + - '(out)' \ + {-v,--verbose}'[be more verbose]' \ + {-q,--quiet}'[be more quiet]' } (( $+functions[_git-quiltimport] )) || @@ -3843,7 +3998,8 @@ _git-quiltimport () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[check patches and warn if they cannot be imported]' \ '--author[default author name and email address to use for patches]: :_email_addresses' \ - '--patches[set directory containing patches]:patch directory:_directories' + '--patches[set directory containing patches]:patch directory:_directories' \ + '--series[specify quilt series file]:series file:_files' } (( $+functions[_git-request-pull] )) || @@ -3861,8 +4017,8 @@ _git-send-email () { '--annotate[review and edit each patch before sending it]' \ '--bcc=[Bcc: value for each email]: :_email_addresses' \ '--cc=[starting Cc: value for each email]: :_email_addresses' \ - '--to-cover[Copy the To: list from the first file to the rest]' \ - '--cc-cover[Copy the Cc: list from the first file to the rest]' \ + '--to-cover[copy the To: list from the first file to the rest]' \ + '--cc-cover[copy the Cc: list from the first file to the rest]' \ '--compose[edit introductory message for patch series]' \ '--from=[specify sender]:email address:_email_addresses' \ '--in-reply-to=[specify contents of first In-Reply-To header]:message-id' \ @@ -3921,150 +4077,127 @@ _git-svn () { declare -a commands commands=( - init:'initialize an empty git repository with additional svn data' - fetch:'fetch revisions from the SVN remote' + blame:'show what revision and author last modified each line of a file' + branch:'create a branch in the SVN repository' clone:'same as init, followed by fetch' - rebase:'fetch revs from SVN parent of HEAD and rebase current work on it' + commit-diff:'commit diff of two tree-ishs' + create-ignore:'recursively finds the svn:ignore property and creates .gitignore files' dcommit:'commit diffs from given head onto SVN repository' - branch:'create a branch in the SVN repository' - tag:'create a tag in the SVN repository' - log:'output SVN log-messages' - blame:'show what revision and author last modified each line of a file' + fetch:'fetch revisions from the SVN remote' find-rev:'output git commit corresponding to the given SVN revision'\''s hash' - set-tree:'commit given commit or tree to SVN repository' - create-ignore:'recursively finds the svn:ignore property and creates .gitignore files' - show-ignore:'output corresponding toplevel .gitignore file of svn:ignore' - mkdirs:'recreate empty directories that Git cannot track' - commit-diff:'commit diff of two tree-ishs' + gc:'compress git-svn-related information' info:'show information about a file or directory' - proplist:'list the SVN properties stored for a file or directory' + init:'initialize an empty git repository with additional svn data' + log:'output SVN log-messages' + migrate:'migrate configuration/metadata/layout from previous versions of git-svn' + mkdirs:'recreate empty directories that Git cannot track' propget:'get a given SVN property for a file' + proplist:'list the SVN properties stored for a file or directory' + propset:'set the value of a property on a file or directory - will be set on commit' + rebase:'fetch revs from SVN parent of HEAD and rebase current work on it' + reset:'undo effect of fetch back to specific revision' + set-tree:'commit given commit or tree to SVN repository' show-externals:'show the subversion externals' - gc:'compress git-svn-related information' - reset:'undo effect of fetch back to specific revision') + show-ignore:'output svn:ignore in format of a toplevel .gitignore file' + tag:'create a tag in the SVN repository' + ) _describe -t commands command commands && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*}-$line[1]: - - declare -a remote_opts fc_opts init_opts cmt_opts opts - - # TODO: --no-auth-cache is undocumented. - # TODO: --config-dir is undocumented. - remote_opts=( - '--username=[username to use for SVN transport]: :_users' - '--ignore-paths[regular expression of paths to not check out]:pattern' - '--no-auth-cache[undocumented]' - '--config-dir=[undocumented]:configuration directory:_directories') - - # TODO: --repack-flags can be improved by actually completing the legal - # flags to git-repack. - # TODO: --noMetadata is undocumented. - # TODO: --useSvmProps is undocumented. - # TODO: --useSvnsyncProps is undocumented. - # TODO: --log-window-size is undocumented. - # TODO: --no-checkout is undocumented. - fc_opts=( - '--localtime[store Git commit times in local timezone]' - '--use-log-author[use author from the first From: or Signed-Off-By: line, when fetching into git]' - '--add-author-from[when committing to svn, append a From: line based on the git commit'\''s author string]' - '( --no-follow-parent)--follow-parent[follow parent commit]' - '(--follow-parent )--no-follow-parent[do not follow parent commit]' - '(-A --authors-file)'{-A,--authors-file}'[specify author-conversion file]:author-conversion file:_files' - '--authors-prog=[program used to generate authors]: :_cmdstring' - '(-q --quiet)'{-q,--quiet}'[make git-svn less verbose]' - '--repack=[repack files (for given number of revisions)]:: :__git_guard_number "revision limit"' - '(--repack-flags --repack-args --repack-opts)'{--repack-flags=,--repack-args=,--repack-opts=}'[flags to pass to git-repack]:git-repack flags' - '--noMetadata[undocumented]' - '--useSvmProps[undocumented]' - '--useSvnsyncProps[undocumented]' - '--log-window-size=[undocumented]' - '--no-checkout[undocumented]' - $remote_opts) - - init_opts=( - '(-T --trunk)'{-T-,--trunk=}'[set trunk sub-directory]:trunk sub-directory:->subdirectory' - '(-t --tags)*'{-t-,--tags=}'[add tags sub-directory]:tags sub-directory:->subdirectory' - '(-b --branches)*'{-b-,--branches=}'[add branches sub-directory]:branches sub-directory:->subdirectory' - '(-s --stdlayout)'{-s,--stdlayout}'[shorthand for setting trunk, tags, branches as relative paths, the SVN default]' - '--no-metadata[set svn-remote.*.noMetadata]' - '--use-svm-props[set svn-remote.*.useSvmProps]' - '--use-svnsync-props[set svn-remote.*.useSvnsyncProps]' - '--rewrite-root=[set svn-remote.*.rewriteRoot]:new root:_urls' - '--rewrite-uuid=[set svn-remote.*.rewriteUUID]:uuid' - '--prefix=[prefix to use for names of remotes]:path prefix:_directories -r ""' - '( --no-minimize-url)--minimize-url[minimize URLs]' - '(--minimize-url )--no-minimize-url[do not minimize URLs]' - '--shared=[share repository amongst several users]:: :__git_repository_permissions' - '--template=[directory to use as a template for the object database]: :_directories' - $remote_opts) - - # TODO: -C and --copy-similarity are undocumented. - cmt_opts=( - '--rmdir[remove empty directories from SVN tree after commit]' - '(-e --edit)'{-e,--edit}'[edit commit message before committing]' - '-l-[limit number of rename/copy targets to run]: :__git_guard_number' - '--find-copies-harder[try harder to find copies]' - '(-C --copy-similarity)'{-C-,--copy-similarity=}'[undocumented]: :_guard "[[\:digit:\]]#" number') - - if [[ $line[1] == (fetch|clone) ]]; then - arguments+=( - '(-r --revision)'{-r,--revision}'[only fetch given revision or revision range]: :__git_svn_revisions' - ':: :__git_svn-remotes') - fi - - if [[ $line[1] == (fetch|rebase|dcommit) ]]; then - # TODO: --fetch-all and --all are undocumented. - opts+=( - '(--fetch-all --all)'{--fetch-all,--all}'[undocumented]') - fi - - if [[ $line[1] == (rebase|dcommit) ]]; then - opts+=( - '(-m --merge)'{-m,--merge}'[use merging strategies, if necessary]' - '*'{-s,--strategy=-}'[use given merge strategy]:merge strategy:__git_merge_strategies') - fi - - if [[ $line[1] == (rebase|dcommit|branch) ]]; then - opts+=( - '(-n --dry-run)'{-n,--dry-run}'[only display what would be done]') - fi - - if [[ $line[1] == (rebase|dcommit|log) ]]; then - opts+=( - '(-v --verbose)'{-v,--verbose}'[display extra information]') - fi + declare -a opts case $line[1] in - (init) - opts+=( - $init_opts) - ;; - (fetch) - opts+=( - '--parent[fetch only from SVN parent of current HEAD]' - $fc_opts) - ;; - (clone) - opts+=( - $init_opts - $fc_opts - ':url:_urls' - '::directory:_directories') - ;; - (rebase) - opts+=( - '--local[do not fetch remotely, rebase against the last fetched commit from SVN]' - $fc_opts) - ;; - (dcommit) - arguments+=( - '--no-rebase[do not rebase or reset after committing]' - '--commit-url[commit to a different SVN url]:SVN URL:_url' - $fc_opts - $cmt_opts) - ;; + (clone|dcommit|fetch|init|migrate|rebase|set-tree) + # TODO: --ignore-refs is undocumented. + # TODO: --no-auth-cache is undocumented. + # TODO: --config-dir is undocumented. + opts+=( + '--config-dir=:configuration directory:_directories' + '--ignore-paths[regular expression of paths to not check out]:perl regex' + '--include-paths[regular expression of paths to check out]:perl regex' + '--ignore-refs:ref' + '--no-auth-cache' + '--username=[username to use for SVN transport]: :_users' + ) + ;| + (clone|dcommit|fetch|log|rebase|set-tree) + opts+=( + '(-A --authors-file)'{-A,--authors-file}'[specify author-conversion file]:author-conversion file:_files' + ) + ;| + (clone|dcommit|fetch|rebase|set-tree) + # TODO: --repack-flags can be improved by actually completing the legal + # flags to git-repack. + # TODO: --no-checkout is undocumented. + opts+=( + "--add-author-from[when committing to svn, append a From: line based on the git commit's author string]" + '--authors-prog=[specify program used to generate authors]: :_cmdstring' + '(--no-follow-parent)--follow-parent[follow parent commit]' + "(--follow-parent)--no-follow-parent[don't follow parent commit]" + '--localtime[store Git commit times in local timezone]' + '--log-window-size=[fetch specified number of log entries per-request]:entries [100]' + '--no-checkout' + '(-q --quiet)'{-q,--quiet}'[make git-svn less verbose]' + '(--repack-flags --repack-args --repack-opts)'{--repack-flags=,--repack-args=,--repack-opts=}'[flags to pass to git-repack]:git-repack flags' + '--repack=[repack files (for given number of revisions)]:: :__git_guard_number "revision limit"' + '--use-log-author[use author from the first From: or Signed-Off-By: line, when fetching into git]' + ) + ;| + (clone|init) + opts+=( + '(-T --trunk)'{-T-,--trunk=}'[set trunk sub-directory]:trunk sub-directory:->subdirectory' + '(-t --tags)*'{-t-,--tags=}'[add tags sub-directory]:tags sub-directory:->subdirectory' + '(-b --branches)*'{-b-,--branches=}'[add branches sub-directory]:branches sub-directory:->subdirectory' + '(-s --stdlayout)'{-s,--stdlayout}'[shorthand for setting trunk, tags, branches as relative paths, the SVN default]' + '--no-metadata[get rid of git-svn-id: lines at the end of every commit]' + '--rewrite-root=[set svn-remote.*.rewriteRoot]:new root:_urls' + '--rewrite-uuid=[set svn-remote.*.rewriteUUID]:uuid' + '--prefix=[prefix to use for names of remotes]:path prefix:_directories -r ""' + '( --no-minimize-url)--minimize-url[minimize URLs]' + "(--minimize-url )--no-minimize-url[don't minimize URLs]" + '--shared=[share repository amongst several users]:: :__git_repository_permissions' + '--template=[directory to use as a template for the object database]: :_directories' + '--use-svm-props[re-map repository URLs and UUIDs from mirrors created with SVN::Mirror]' + '--use-svnsync-props[re-map repository URLs and UUIDs from mirrors created with svnsync]' + ) + ;| + (commitdiff|dcommit|set-tree) + # TODO: -C and --copy-similarity are undocumented. + opts+=( + '(-C --copy-similarity)'{-C-,--copy-similarity=}': :_guard "[[\:digit:\]]#" number' + '(-e --edit)'{-e,--edit}'[edit commit message before committing]' + '-l-[limit number of rename/copy targets to run]: :__git_guard_number' + '--find-copies-harder[try harder to find copies]' + '--rmdir[remove empty directories from SVN tree after commit]' + ':: :__git_svn-remotes' + ) + ;| + (fetch|clone) + opts+=( + '(-r --revision)'{-r,--revision}'[only fetch given revision or revision range]: :__git_svn_revisions' + ':: :__git_svn-remotes' + ) + ;| + (fetch|rebase|dcommit) + # TODO: --fetch-all and --all are undocumented. + opts+=( '(--fetch-all --all)'{--fetch-all,--all} ) + ;| + (rebase|dcommit) + opts+=( + '(-M -m --merge)'{-M,-m,--merge}'[use merging strategies, if necessary]' + '*'{-s,--strategy=-}'[use given merge strategy]:merge strategy:__git_merge_strategies' + ) + ;| + (rebase|dcommit|branch|tag) + opts+=( + '(-n --dry-run)'{-n,--dry-run}'[only display what would be done]' + ) + ;| + (rebase|dcommit|log) + opts+=( '(-v --verbose)'{-v,--verbose}'[display extra information]' ) + ;| (branch|tag) # TODO: -d/--destination should complete output of # git config --get-all svn-remote.*.branches @@ -4074,15 +4207,82 @@ _git-svn () { # git config --get-all svn-remote.*.commiturl opts+=( '(-m --message)'{-m,--message}'[specify the commit message]:message' - '(-d --destination)'{-d,--destination}'[location of branch or tag to create in SVN repository]: :_directories' + '(-d --destination)'{-d,--destination}"[location of $line[1] to create in SVN repository]: :_directories" '--username[specify SVN username to perform commit as]: :_users' - '--commit-url[specify URL to connect to destination SVN repository]: :_urls') - - if [[ $line[1] != tag ]]; then - opts+=( - '(-t --tag)'{-t,--tag}'[create a tag]') - fi - ;; + '--commit-url[specify URL to connect to destination SVN repository]: :_urls' + '--parents[create parent folders]' + ) + ;| + (commit-diff|create-ignore|dcommit|show-ignore|mkdirs|proplist|propget|show-externals) + # TODO: -r and --revision is undocumented for dcommit, show-ignore and mkdirs. + opts+=( + '(-r --revision)'{-r,--revision}'[specify SVN revision]: :__git_svn_revisions' + ) + ;| + (propset|propget) + opts+=( '1:property:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock)' ) + ;| + + # ;| style fall-throughs end; here on each command covered once + (blame) + opts+=( + '--git-format[produce output in git-blame format, with SVN revision numbers instead of git commit hashes]' + '*:file:__git_cached_files' + ) + ;; + (branch) + opts+=( '(-t --tag)'{-t,--tag}'[create a tag]' ) + ;; + (clone) + opts+=( + '--preserve-empty-dirs[create a placeholder file for each empty directory]' + '--placeholder-filename=[specify name of placeholder files created by --preserve-empty-dirs]:filename [.gitignore]:_files' + ':url:_urls' + '::directory:_directories' + ) + ;; + (commit-diff) + # TODO: -m and --message is undocumented. + # TODO: -F and --file is undocumented. + opts+=( + '(-m --message)'{-m-,--message=}':message' + '(-F --file)'{-F-,--file=}':file:_files' + ':original tree:__git_tree_ishs' + ':new tree result:__git_tree_ishs' + ':target:_urls' + ) + ;; + (dcommit) + # TODO: --set-svn-props is undocumented + opts+=( + '--commit-url[commit to a different SVN url]:SVN URL:_url' + '(-i --interactive)'{-i,--interactive}'[ask for confirmation that a patch should be sent to SVN]' + '--mergeinfo[add specified merge information during the dcommit]:mergeinfo' \ + "--no-rebase[don't rebase or reset after committing]" + '--set-svn-props:arg' + ) + ;; + (fetch) + opts+=( + '(-p --parent)'{-p,--parent}'[fetch only from SVN parent of current HEAD]' + ) + ;; + (info) + opts+=( + '--url[output only value of URL field]' + ':file:__git_cached_files' + ) + ;; + (init) + opts+=( ':SVN URL:_urls' ':target directory:_directories' ) + ;; + (find-rev) + opts+=( + '(-A --after -B --before)'{-B,--before}'[with no exact match, find last commit for current branch]' + '(-A --after -B --before)'{-A,--after}'[with no exact match, find closest match searching forwards]' + ':revision: _alternative "svn-revisions\:svn revision number\:__git_svn_revision_numbers -p r" "git-revisions\:git revision\:__git_revisions"' + ) + ;; (log) declare -a revision_options __git_setup_revision_options @@ -4096,47 +4296,46 @@ _git-svn () { '--limit=[like --max-count, but not counting merged/excluded commits]: :__git_guard_number limit' '--incremental[give output suitable for concatenation]' '--show-commit[output git commit SHA-1, as well]' - '--color[undocumented]' - '--pager[undocumented]:pager:_cmdstring' - '--non-recursive[undocumented]') - ;; - (blame) - opts+=( - '--git-format[produce output in git-blame format, with SVN revision numbers instead of git commit hashes]') - ;; - (set-tree) - opts+=( - '--stdin[read list of commits to commit from stdin]') - ;; - (create-ignore|show-ignore|mkdirs|proplist|propget|show-externals) - # TODO: -r and --revision is undocumented for show-ignore and mkdirs. - opts+=( - '(-r --revision)'{-r,--revision}'[specify SVN revision]: :__git_svn_revisions') - ;; - (commit-diff) - # TODO: -m and --message is undocumented. - # TODO: -F and --file is undocumented. - # TODO: -r and --revision is undocumented. - opts+=( - '(-m --message)'{-m-,--message=}'[undocumented]:message' - '(-F --file)'{-F-,--file=}'[undocumented]: :_files' - '(-r --revision)'{-r-,--revision=}'[undocumented]: :__git_svn_revisions') - ;; - (info) + '--color' + '--pager:pager:_cmdstring' + '--non-recursive' + ':file:__git_cached_files' + ) + ;; + (migrate) + opts+=( '--minimize' ) + ;; + (propset) + opts+=( ':value' ) + ;& + (proplist|propget) + opts+=( '*:file:__git_cached_files' ) + ;; + (rebase) opts+=( - '--url[output only value of URL field]') - ;; + '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]" + '(--preserve-merges -p)'{--preserve-merges,-p}'[try to recreate merges instead of ignoring them]' + ) + ;; (reset) opts+=( '(-r --revision)'{-r,--revision}'[specify most recent SVN revision to keep]: :__git_svn_revisions' - '(-p --parent)'{-p,--parent}'[discard specified revision as well, keeping nearest parent instead]') - ;; + '(-p --parent)'{-p,--parent}'[discard specified revision as well, keeping nearest parent instead]' + ) + ;; + (set-tree) + opts+=( '--stdin[read list of commits to commit from stdin]' ) + ;; + (create-ignore|gc|mkdirs|show-externals|show-ignore|tag) ;; + (*) # fallback to files on any new/unrecognised commands + opts+=( '*:file:_files' ) + ;; esac - _arguments -w -C -S -s \ - '(-h -H --help)'{-h,-H,--help}'[display usage information]' \ - '(-V --version)'{-V,--version}'[display version information]' \ - '--minimize-connections[undocumented]' \ + _arguments -C -S -s \ + '(-)'{-h,-H}'[display usage information]' \ + '(-)'{-V,--version}'[display version information]' \ + '--minimize-connections' \ '(-R --svn-remote --remote)'{-R,--svn-remote,--remote}'[svn remote to use]:svn remote:__git_svn-remotes' \ '(-i --id)'{-i,--id}'[set GIT_SVN_ID]:GIT_SVN_ID' \ $opts && ret=0 @@ -4163,7 +4362,7 @@ _git-apply () { local -a apply_options __git_setup_apply_options - _arguments -w -S -s \ + _arguments -S -s \ $apply_options \ '(--index --cached --reject)'{-3,--3way}'[fall back on 3-way merge if patch fails]' \ '--stat[output diffstat for input (turns off "apply")]' \ @@ -4178,6 +4377,7 @@ _git-apply () { '--unidiff-zero[disable unified-diff-context check]' \ '--apply[apply patches that would otherwise not be applied]' \ '--no-add[ignore additions made by the patch]' \ + '--allow-overlap[allow overlapping hunks]' \ '--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \ '(-v --verbose)'{-v,--verbose}'[display progress on stderr]' \ '--recount[do not trust line counts in hunk headers]' \ @@ -4192,33 +4392,30 @@ _git-checkout-index () { z_opt='-z[paths are separated with NUL character when reading from standard input]' fi - _arguments -w -S -s \ + _arguments -S -s \ '(-u --index)'{-u,--index}'[update stat information in index]' \ - '(-q --quiet)'{-q,--quiet}'[do not complain about existing files or missing files]' \ + '(-q --quiet)'{-q,--quiet}'[no warning for existing files and files not in index]' \ '(-f --force)'{-f,--force}'[force overwrite of existing files]' \ '(-a --all --stdin *)'{-a,--all}'[check out all files in index]' \ '(-n --no-create)'{-n,--no-create}'[do not checkout new files]' \ - '--prefix=-[prefix to use when creating files]:directory:_directories' \ - '--stage=-[check out files from named stage]:stage:(1 2 3 all)' \ '--temp[write content to temporary files]' \ '(-a --all *)--stdin[read list of paths from the standard input]' \ + '--prefix=[prefix to use when creating files]:directory:_directories' \ + '--stage=[check out files from named stage]:stage:(1 2 3 all)' \ $z_opt \ '*: :__git_cached_files' } (( $+functions[_git-commit-tree] )) || _git-commit-tree () { - if (( CURRENT == 2 )); then - _arguments \ - '-h[display usage]' \ - ': :__git_trees' - elif [[ $words[CURRENT-1] == -p ]]; then - local expl - _description commits expl 'parent commit' - __git_objects $expl - else - compadd - '-p' - fi + _arguments \ + '-h[display usage]' \ + '*-p+[specify parent commit]:parent commit:__git_objects' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ + '-F+[read commit log from specified file]:file:_files' \ + '*-m+[specify paragraph of commit log message]:message' \ + ': :__git_trees' } (( $+functions[_git-hash-object] )) || @@ -4231,6 +4428,7 @@ _git-hash-object () { '-w[write object to object database]' \ '(: --stdin-paths)--stdin[read object from standard input]' \ '(: --stdin --path)--stdin-paths[read file names from standard input instead of from command line]' \ + '--literally[just hash any random garbage to create corrupt objects for debugging Git]' \ '( --no-filters)--path=[hash object as if it were located at given path]: :_files' \ '(--path )--no-filters[hash contents as is, ignoring any input filters]' \ '(--stdin --stdin-paths):file:_files' @@ -4254,6 +4452,7 @@ _git-index-pack () { '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ + '--threads=[specify number of threads to use]:threads' \ ':pack file:_files -g "*.pack(-.)"' } @@ -4280,7 +4479,7 @@ _git-merge-file () { '(--ours --union)--theirs[resolve conflicts favoring their side of the lines]' \ '(--ours --theirs )--union[resolve conflicts favoring both sides of the lines]' \ '--marker-size[specify length of conflict markers]: :__git_guard_number "marker length"' \ - '--diff3[undocumented]' \ + '--diff3[use a diff3 based merge]' \ ':current file:_files' \ ':base file:_files' \ ':other file:_files' @@ -4310,7 +4509,7 @@ _git-mktag () { (( $+functions[_git-mktree] )) || _git-mktree () { - _arguments -w -S -s \ + _arguments -S -s \ '-z[read NUL-terminated ls-tree -z output]' \ '--missing[allow missing objects]' \ '--batch[allow creation of more than one tree]' @@ -4325,42 +4524,45 @@ _git-pack-objects () { fi # NOTE: --index-version is only used by the Git test suite. - # TODO: --reflog is undocumented. - # TODO: --keep-unreachable is undocumented. - # TODO: --unpack-unreachable is undocumented. _arguments -A '-*' \ - '(: --max-pack-size)--stdout[write pack contents to standard output]' \ + '(-q --quiet)'{-q,--quiet}"[don't report progress]" \ + '(-q --quiet --all-progress)--progress[show progress meter]' \ + '(-q --quiet --progress --all-progress-implied)--all-progress[show progress meter during object writing phase]' \ + '(-q --quiet --all-progress)--all-progress-implied[like --all-progress, but only if --progress was also passed]' \ + '(--stdout)--max-pack-size=[specify maximum size of each output pack file]: : __git_guard_bytes "maximum pack size"' \ + '(--incremental)--local[similar to --incremental, but only ignore unpacked non-local objects]' \ + '(--local)--incremental[ignore objects that have already been packed]' \ + '--window=-[limit pack window by objects]: :__git_guard_number "window size"' \ + '--window-memory=-[specify window size in memory]: : __git_guard_bytes "window size"' \ + '--depth=-[maximum delta depth]: :__git_guard_number "maximum delta depth"' \ + "--no-reuse-delta[don't reuse existing deltas, but compute them from scratch]" \ + "--no-reuse-object[don't reuse existing object data]" \ + '--delta-base-offset[use delta-base-offset packing]' \ + '--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \ + '--non-empty[only create a package if it contains at least one object]' \ '--revs[read revision arguments from standard input]' \ '(--revs)--unpacked[limit objects to pack to those not already packed]' \ '(--revs)--all[include all refs as well as revisions already specified]' \ + '--reflog[include objects referred by reflog entries]' \ + '--indexed-objects[include objects referred to by the index]' \ + '(: --max-pack-size)--stdout[output pack to stdout]' \ '--include-tag[include unasked-for annotated tags if object they reference is included]' \ - '--window=-[number of objects to use per delta compression]: :__git_guard_number "window size"' \ - '--depth=-[maximum delta depth]: :__git_guard_number "maximum delta depth"' \ - '--window-memory=-[window size in memory]:window size:__git_guard_bytes' \ - '(--stdout)--max-pack-size=[maximum size of each output packfile]:maximum pack size:__git_guard_bytes' \ + '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \ + '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \ + '--include-tag[include tag objects that refer to objects to be packed]' \ + $thin_opt \ + '--shallow[create packs suitable for shallow fetches]' \ '--honor-pack-keep[ignore objects in local pack with .keep file]' \ - '( --local)--incremental[ignore objects that have already been packed]' \ - '(--incremental )--local[similar to --incremental, but only ignore unpacked non-local objects]' \ - '--non-empty[only create a package if it contains at least one object]' \ - '( --all-progress)--progress[display progress on standard error]' \ - '(--progress --all-progress-implied)--all-progress[display progress output on standard error, even during write-out phase]' \ - '(--all-progress)--all-progress-implied[like --all-progress, but only if --progress was also passed]' \ - '-q[do not report progress]' \ - '--no-reuse-delta[do not reuse existing deltas, but compute them from scratch]' \ - '--no-reuse-object[do not reuse existing object data]' \ '--compression=-[specify compression level]: :__git_compression_levels' \ - $thin_opt \ - '--delta-base-offset[use delta-base-offset packing]' \ - '--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \ '--keep-true-parents[pack parents hidden by grafts]' \ - '( --unpack-unreachable)--keep-unreachable[undocumented]' \ - '(--keep-unreachable )--unpack-unreachable[undocumented]' \ + '--use-bitmap-index[use a bitmap index if available to speed up counting objects]' \ + '--write-bitmap-index[write a bitmap index together with the pack index]' \ ':base-name:_files' } (( $+functions[_git-prune-packed] )) || _git-prune-packed () { - _arguments -w -S -s \ + _arguments -S -s \ '(-n --dry-run)'{-n,--dry-run}'[only list objects that would be removed]' \ '(-q --quiet)'{-q,--quiet}'[do not display progress on standard error]' } @@ -4389,7 +4591,7 @@ _git-read-tree () { exclude_per_directory_opt='--exclude-per-directory=-[specify .gitignore file]:.gitignore file:_files' fi - _arguments -w -S -s \ + _arguments -S -s \ '( --reset --prefix)-m[perform a merge, not just a read]' \ '(-m --prefix)--reset[perform a merge, not just a read, ignoring unmerged entries]' \ '(-m --reset 2 3)--prefix=-[read the contents of specified tree-ish under specified directory]:prefix:_directories -r ""' \ @@ -4409,7 +4611,7 @@ _git-read-tree () { (( $+functions[_git-symbolic-ref] )) || _git-symbolic-ref () { - _arguments -w -S -s \ + _arguments -S -s \ '(-d --delete)'{-d,--delete}'[delete symbolic ref]' \ '(-q --quiet)'{-q,--quiet}'[do not issue error if specified name is not a symbolic ref]' \ '--short[shorten the ref name (eg. refs/heads/master -> master)]' \ @@ -4436,13 +4638,11 @@ _git-update-index () { fi _arguments -S \ - $refreshables \ '(-)'{-h,--help}'[display usage information]' \ + '-q[continue refresh even when index needs update]' \ '--add[add files not already in index]' \ - '( --force-remove)--remove[remove files that are in the index but are missing from the work tree]' \ - '(--remove )--force-remove[remove files from both work tree and index]' \ + '(--force-remove)--remove[remove files that are in the index but are missing from the work tree]' \ '(-q --unmerged --ignore-missing --really-refresh)--refresh[refresh index]' \ - '-q[run quietly]' \ '--ignore-submodules[do not try to update submodules]' \ '--unmerged[if unmerged changes exists, ignore them instead of exiting]' \ '--ignore-missing[ignore missing files when refreshing the index]' \ @@ -4457,10 +4657,16 @@ _git-update-index () { '(-)'{-g,--again}'[run git-update-index on differing index entries]' \ '(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \ '--info-only[only insert files object-IDs into index]' \ - '(--remove)--force-remove[remove file from index even when working directory has no such file]' \ '--replace[replace files already in index, if necessary]' \ + '(--remove)--force-remove[remove named paths even if present in worktree]' \ '(: -)--stdin[read list of paths from standard input]' \ '--verbose[report what is being added and removed from the index]' \ + '--clear-resolve-undo[forget saved unresolved conflicts]' \ + '--index-version=[write index in specified on-disk format version]:version:(2 3 4)' \ + '--split-index[enable/disable split index]' \ + '--untracked-cache[enable/disable untracked cache]' \ + '--test-untracked-cache[test if the filesystem supports untracked cache]' \ + '--force-untracked-cache[enable untracked cache without testing the filesystem]' \ $z_opt \ '*:: :_files' } @@ -4473,12 +4679,13 @@ _git-update-ref () { z_opt='-z[values are separated with NUL character when reading from stdin]' fi - _arguments -w -S -s \ + _arguments -S -s \ '-m[update reflog for specified name with specified reason]:reason for update' \ '(:)-d[delete given reference after verifying its value]:symbolic reference:__git_revisions:old reference:__git_revisions' \ '(-d --no-deref)--stdin[reads instructions from standard input]' \ $z_opt \ '(-d -z --stdin)--no-deref[overwrite ref itself, not what it points to]' \ + '--create-reflog[create a reflog]' \ ':symbolic reference:__git_revisions' \ ':new reference:__git_revisions' \ '::old reference:__git_revisions' @@ -4487,7 +4694,7 @@ _git-update-ref () { (( $+functions[_git-write-tree] )) || _git-write-tree () { # NOTE: --ignore-cache-tree is only used for debugging. - _arguments -w -S -s \ + _arguments -S -s \ '--missing-ok[ignore objects in index that are missing in object database]' \ '--prefix=[write tree representing given sub-directory]:sub-directory:_directories -r ""' } @@ -4496,14 +4703,17 @@ _git-write-tree () { (( $+functions[_git-cat-file] )) || _git-cat-file () { - _arguments -w -S -s \ + _arguments -S -s \ '(- 1)-t[show type of given object]' \ '(- 1)-s[show size of given object]' \ '(- 1)-e[exit with zero status if object exists]' \ '(- 1)-p[pretty-print given object]' \ '(- 1)--textconv[show content as transformed by a textconv filter]' \ - '(- :)--batch=-[print SHA1, type, size and contents (or in ) of objects given on stdin]:format' \ - '(- :)--batch-check=-[print SHA1, type and size (or in ) of objects given on stdin]:format' \ + '--allow-unknown-type[allow -s and -t to work with broken/corrupt objects]' \ + '(- :)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \ + '(- :)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \ + '--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \ + '--batch-all-objects[show all objects with --batch or --batch-check]' \ '(-):object type:(blob commit tag tree)' \ ': :__git_objects' } @@ -4514,7 +4724,7 @@ _git-diff-files () { __git_setup_revision_options __git_setup_diff_stage_options - _arguments -w -S -s \ + _arguments -S -s \ $revision_options \ $diff_stage_options \ ': :__git_changed-in-working-tree_files' \ @@ -4533,7 +4743,7 @@ _git-diff-index () { # to given tree-ish? This should be done for git-diff as well, in that case. _arguments -S \ $revision_options \ - '--cached[do not consider the work tree at all]' \ + "--cached[don't consider the work tree at all]" \ '-m[flag non-checked-out files as up-to-date]' \ ': :__git_tree_ishs' \ '*: :__git_cached_files' @@ -4550,7 +4760,7 @@ _git-diff-tree () { # NOTE: -r, -t, --root are actually parsed for all # __git_setup_revision_options, but only used by this command, so only have # them here. - _arguments -w -C -S -s \ + _arguments -C -S -s \ $revision_options \ '-r[recurse into subdirectories]' \ '(-r )-t[disply tree objects in diff output]' \ @@ -4595,10 +4805,14 @@ _git-for-each-ref () { # TODO: Better completion for --format: should complete %(field) stuff, that # is, %(refname), %(objecttype), %(objectsize), %(objectname) with optional '*' # in front. - _arguments -w -S -s \ + _arguments -S -s \ '--count=[maximum number of refs to iterate over]: :__git_guard_number "maximum number of refs"' \ - '--sort=[key to sort refs by]: :__git_ref_sort_keys' \ + '*--sort=[key to sort refs by]: :__git_ref_sort_keys' \ '--format=-[output format of ref information]:format' \ + '*--points-at=[print only refs which point at the given object]:object:__git_commits' \ + '*--merged=[print only refs that are merged]:object:__git_commits' \ + '*--no-merged=[print only refs that are not merged]:object:__git_commits' \ + '*--contains=[print only refs which contain the commit]:object:__git_commits' \ '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \ '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \ '(-s --shell -p --perl --tcl)'--python'[use string literals suitable for Python]' \ @@ -4611,13 +4825,13 @@ _git-ls-files () { local no_empty_directory_opt= if (( words[(I)--directory] )); then - no_empty_directory_opt='--no-empty-directory[do not list empty directories]' + no_empty_directory_opt="--no-empty-directory[don't list empty directories]" fi # TODO: --resolve-undo is undocumented. # TODO: Replace _files with something more intelligent based on seen options. # TODO: Apply excludes like we do for git-clean. - _arguments -w -S -s \ + _arguments -S -s \ '(-c --cached)'{-c,--cached}'[show cached files in output]' \ '(-d --deleted)'{-d,--deleted}'[show deleted files in output]' \ '(-m --modified)'{-m,--modified}'[show modified files in output]' \ @@ -4625,6 +4839,7 @@ _git-ls-files () { '(-i --ignored)'{-i,--ignored}'[show ignored files in output]' \ '(-s --stage --with-tree)'{-s,--stage}'[show stage files in output]' \ '--directory[if a whole directory is classified as "other", show just its name]' \ + '--eol[show line endings of files]' \ $no_empty_directory_opt \ '(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \ '(-k --killed)'{-k,--killed}'[show killed files in output]' \ @@ -4638,6 +4853,7 @@ _git-ls-files () { '-v[identify each files status (hmrck?)]' \ '--full-name[force paths to be output relative to the project top directory]' \ '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--debug[show debugging data]' \ '*:: :_files' } @@ -4645,11 +4861,14 @@ _git-ls-files () { _git-ls-remote () { # TODO: repository needs fixing _arguments -A '-*' \ + '(-q --quiet)'{-q,--quiet}"[don't print remote URL]" \ + '--upload-pack=[specify path to git-upload-pack on remote side]:remote path' \ '(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \ '(-t --tags)'{-t,--tags}'[show only refs under refs/tags]' \ - '(-u --upload-pack)'{-u,--upload-pack=-}'[specify path to git-upload-pack on remote side]:remote path' \ + "--refs[don't show peeled tags]" \ '--exit-code[exit with status 2 when no matching refs are found in the remote repository]' \ '--get-url[expand the URL of the given repository taking into account any "url..insteadOf" config setting]' \ + '--symref[show underlying ref in addition to the object pointed by it]' \ ': :__git_any_repositories' \ '*: :__git_references' } @@ -4659,7 +4878,7 @@ _git-ls-tree () { local curcontext=$curcontext state line ret=1 declare -A opt_args - _arguments -w -C -S -s \ + _arguments -C -S -s \ '(-t)-d[do not show children of given tree (implies -t)]' \ '-r[recurse into subdirectories]' \ '-t[show tree entries even when going to recurse them]' \ @@ -4683,7 +4902,7 @@ _git-ls-tree () { (( $+functions[_git-merge-base] )) || _git-merge-base () { - _arguments -w -S -s \ + _arguments -S -s \ '(-a --all)'{-a,--all}'[display all common ancestors]' \ '--octopus[compute best common ancestors of all supplied commits]' \ '--is-ancestor[tell if A is ancestor of B (by exit status)]' \ @@ -4757,7 +4976,7 @@ _git-show-index () { _git-show-ref () { _arguments -S \ - list \ - '(-h --head)'{-h,--head}'[show the HEAD reference, even if it would normally be filtered out]' \ + '--head[show the HEAD reference, even if it would normally be filtered out]' \ '--tags[show only refs/tags]' \ '--heads[show only refs/heads]' \ '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \ @@ -4789,7 +5008,7 @@ _git-var () { (( $+functions[_git-verify-pack] )) || _git-verify-pack () { - _arguments -w -S -s \ + _arguments -S -s \ '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \ '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \ '*:index file:_files -g "*.idx"' @@ -4837,6 +5056,7 @@ _git-fetch-pack () { # TODO: Limit * to __git_head_references? _arguments -A '-*' \ '--all[fetch all remote refs]' \ + '--stdin[take the list of refs from stdin]' \ '(-q --quiet)'{-q,--quiet}'[make output less verbose]' \ '(-k --keep)'{-k,--keep}'[do not invoke git-unpack-objects on received data]' \ '--thin[fetch a thin pack]' \ @@ -4844,6 +5064,7 @@ _git-fetch-pack () { '(--upload-pack --exec)'{--upload-pack=-,--exec=-}'[specify path to git-upload-pack on remote side]:remote path' \ '--depth=-[limit fetching to ancestor-chains not longer than given number]: :__git_guard_number "maximum ancestor-chain length"' \ '--no-progress[do not display progress]' \ + '--diag-url' \ '-v[produce verbose output]' \ ': :__git_any_repositories' \ '*: :__git_references' @@ -4856,6 +5077,12 @@ _git-http-backend () { (( $+functions[_git-send-pack] )) || _git-send-pack () { + local -a sign + sign=( + {yes,true}'\:always,\ and\ fail\ if\ unsupported\ by\ server' + {no,false}'\:never' + if-asked'\:iff\ supported\ by\ server' + ) _arguments -A '-*' \ '(-v --verbose)'{-v,--verbose}'[produce verbose output]' \ '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ @@ -4865,12 +5092,14 @@ _git-send-pack () { '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \ '--mirror[mirror all refs]' \ '(-f --force)'{-f,--force}'[update remote orphaned refs]' \ - '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \ '(--no-signed --sign)--signed[GPG sign the push]' \ - "(--sign --sign)--no-signed[don't GPG sign the push]" \ + "(--sign --signed)--no-signed[don't GPG sign the push]" \ + '--progress[force progress reporting]' \ '--thin[send a thin pack]' \ '--atomic[request atomic transaction on remote side]' \ '--stateless-rpc[use stateless RPC protocol]' \ + '--stdin[read refs from stdin]' \ '--helper-status[print status from remote helper]' \ '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \ ': :__git_any_repositories' \ @@ -4879,7 +5108,7 @@ _git-send-pack () { (( $+functions[_git-update-server-info] )) || _git-update-server-info () { - _arguments -w -S -s \ + _arguments -S -s \ '(-f --force)'{-f,--force}'[update the info files from scratch]' } @@ -4917,6 +5146,7 @@ _git-receive-pack () { # TODO: --advertise-refs is undocumented. # TODO: --stateless-rpc is undocumented. _arguments -A '-*' \ + '(-q --quiet)'{-q,--quiet}'[be quiet]' \ '--advertise-refs[undocumented]' \ '--stateless-rpc[undocumented]' \ ':directory to sync into:_directories' @@ -4978,10 +5208,9 @@ _git-upload-pack () { # TODO: --advertise-refs is undocumented. # TODO: --stateless-rpc is undocumented. _arguments -S -A '-*' \ - '--strict[do not try /.git/ if is not a git directory' \ + "--strict[don't try /.git/ if is not a git directory]" \ '--timeout=-[interrupt transfer after given number of seconds of inactivity]: :__git_guard_number "inactivity timeout"' \ - '--advertise-refs[undocumented]' \ - '--stateless-rpc[undocumented]' \ + --advertise-refs --stateless-rpc \ ': :_directories' } @@ -5041,15 +5270,15 @@ _git-check-ref-format () { '(--no-allow-onelevel)--allow-onelevel[accept one-level refnames]' \ '(--allow-onelevel)--no-allow-onelevel[do not accept one-level refnames]' \ '--refspec-pattern[interpret as a reference name pattern for a refspec]' \ - '--normalize[Normalize refname by removing leading slashes]' \ + '--normalize[normalize refname by removing leading slashes]' \ '--branch[expand previous branch syntax]' \ ': :__git_references' } (( $+functions[_git-fmt-merge-msg] )) || _git-fmt-merge-msg () { - _arguments -w -S -s \ - '( --no-log)--log[display one-line descriptions from actual commits being merged]' \ + _arguments -S -s \ + '( --no-log)--log=-[display one-line descriptions from actual commits being merged]::number of commits [20]' \ '(--log )--no-log[do not display one-line descriptions from actual commits being merged]' \ '(-m --message)'{-m+,--message=}'[use given message instead of branch names for first line in log message]:message' \ '(-F --file)'{-F,--file}'[specify list of merged objects from file]: :_files' @@ -5059,10 +5288,12 @@ _git-fmt-merge-msg () { _git-mailinfo () { # TODO: --no-inbody-headers is undocumented. _arguments -A '-*' \ - '-k[do not strip/add \[PATCH\] from first line of commit message]' \ + '(-b)-k[prevent removal of cruft from Subject: header]' \ + '(-k)-b[limit stripping of bracketed strings to the word PATCH]' \ '(-u --encoding)-u[encode commit information in UTF-8]' \ '(-u --encoding)--encoding=-[encode commit information in given encoding]: :__git_encodings' \ '-n[disable all charset re-coding of metadata]' \ + '(-m --message-id)'{-m,--message-id}'[copy the Message-ID header at the end of the commit message]' \ '( --no-scissors)--scissors[remove everything in body before a scissors line]' \ '(--scissors )--no-scissors[do not remove everything in body before a scissors line]' \ '--no-inbody-headers[undocumented]' \ @@ -5088,7 +5319,9 @@ _git-merge-one-file () { (( $+functions[_git-patch-id] )) || _git-patch-id () { - _message 'no arguments allowed; accepts patch on standard input' + _arguments \ + '--stable[use a sum of hashes unaffected by diff ordering]' \ + '--unstable[use patch-id compatible with git 1.9 and older]' } # NOTE: git-sh-setup isn't a user command. @@ -5282,8 +5515,10 @@ _git_commands () { stash:'stash away changes to dirty working directory' status:'show working-tree status' submodule:'initialize, update, or inspect submodules' - tag:'create, list, delete or verify tag object signed with GPG') - + subtree:'split repository into subtrees and merge them' + tag:'create, list, delete or verify tag object signed with GPG' + worktree:'manage multiple working dirs attached to the same repository' + ) ancillary_manipulator_commands=( config:'get and set repository or global options' fast-export:'data exporter' @@ -6117,8 +6352,7 @@ __git_submodules () { local expl declare -a submodules - submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *}) - __git_command_successful $pipestatus || return 1 + submodules=( ${${${(f)"$(_call_program submodules git submodule)"}#?* }%% *} ) _wanted submodules expl submodule compadd "$@" -a - submodules } @@ -6495,7 +6729,7 @@ __git_guard_number () { (( $+functions[__git_guard_bytes] )) || __git_guard_bytes () { - _guard '[[:digit:]]#([kKmMgG]|)' $* + _guard '[[:digit:]]#([kKmMgG]|)' ${*:-size} } (( $+functions[__git_datetimes] )) || @@ -6525,7 +6759,9 @@ __git_setup_log_options () { '(--decorate )--no-decorate[do not print out ref names of any commits that are shown]' '( --no-follow)--follow[follow renames]' '(--follow )--no-follow[do not follow renames]' - '--source[show which ref each commit is reached from]') + '--source[show which ref each commit is reached from]' + '-L+[trace the evolution of a line range or regex within a file]:range' + ) } (( $+functions[__git_setup_diff_options] )) || @@ -6572,7 +6808,7 @@ __git_setup_diff_options () { '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]' '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' '(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size' - '(-M --find-renames)'{-M-,--find-renames=-}'[Detect renames with given scope]:: :__git_guard_number size' + '(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size' '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size' '--find-copies-harder[try harder to find copies]' '(-D --irreversible-delete)'{-D,--irreversible-delete}'[omit the preimage for deletes]' @@ -6592,7 +6828,6 @@ __git_setup_diff_options () { '--ignore-blank-lines[do not show hunks that add or remove blank lines]' '--inter-hunk-context=[combine hunks closer than n lines]:n' '--exit-code[report exit code 1 if differences, 0 otherwise]' - '(--exit-code)--quiet[disable all output]' '( --no-ext-diff)--ext-diff[allow external diff helper to be executed]' '(--ext-diff )--no-ext-diff[disallow external diff helper to be executed]' '(--textconv --no-textconv)--textconv[allow external text conversion filters to be run when comparing binary files]' @@ -6717,7 +6952,6 @@ __git_setup_revision_options () { '(-v --header)'{--pretty=-,--format=-}'[pretty print commit messages]::format:__git_format_placeholders' '(--abbrev-commit --no-abbrev-commit)--abbrev-commit[show only partial prefixes of commit object names]' '(--abbrev-commit --no-abbrev-commit)--no-abbrev-commit[show the full 40-byte hexadecimal commit object name]' - '(--abbrev --no-abbrev)--abbrev=[set minimum SHA1 display-length (for use with --abbrev-commit)]: :__git_guard_number length' '(--abbrev --no-abbrev)--no-abbrev[show the full 40-byte hexadecimal commit object name]' '--oneline[shorthand for --pretty=oneline --abbrev-commit]' '--encoding=-[output log messages in given encoding]:: :__git_encodings' @@ -6806,39 +7040,45 @@ __git_setup_merge_options () { merge_options=( '( --no-commit)--commit[perform the merge and commit the result]' '(--commit )--no-commit[perform the merge but do not commit the result]' - '( --no-edit)--edit[open an editor to change the commit message]' - '(--edit )--no-edit[do not open an editor to change the commit message]' + '( --no-edit -e)--edit[open an editor to change the commit message]' + "(--edit -e)--no-edit[don't open an editor to change the commit message]" '( --no-ff)--ff[do not generate a merge commit if the merge resolved as a fast-forward]' '(--ff )--no-ff[generate a merge commit even if the merge resolved as a fast-forward]' - '( --no-log)--log[fill in one-line descriptions of the commits being merged in the log message]' + '( --no-log)--log=-[add entries from shortlog to merge commit message]::entries to add' '(--log )--no-log[do not list one-line descriptions of the commits being merged in the log message]' '(-n --no-stat)--stat[show a diffstat at the end of the merge]' '(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]' '( --no-squash)--squash[merge, but do not commit]' '(--squash )--no-squash[merge and commit]' '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]' - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' - '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' + "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]' '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]' - '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]') + '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' + '--allow-unrelated-histories[allow merging unrelated histories]' + ) } (( $+functions[__git_setup_fetch_options] )) || __git_setup_fetch_options () { fetch_options=( - '(: *)--all[fetch all remotes]' + '(: * -m --multiple)--all[fetch all remotes]' '(-a --append)'{-a,--append}'[append ref names and object names of fetched refs to "$GIT_DIR/FETCH_HEAD"]' + '(-j --jobs)'{-j+,--jobs=}'[specify number of submodules fetched in parallel]:jobs' '--depth=[deepen the history of a shallow repository by the given number of commits]: :__git_guard_number depth' '--unshallow[convert a shallow clone to a complete one]' + '--update-shallow[accept refs that update .git/shallow]' + '--refmap=[specify refspec to map refs to remote tracking branches]:refspec' + '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' + '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' '--dry-run[show what would be done, without making any changes]' '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' '(-k --keep)'{-k,--keep}'[keep downloaded pack]' '(-p --prune)'{-p,--prune}'[remove any remote tracking branches that no longer exist remotely]' - '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' '(--no-tags -t --tags)'{-t,--tags}'[fetch remote tags]' '(-u --update-head-ok)'{-u,--update-head-ok}'[allow updates of current branch head]' '--upload-pack=[specify path to git-upload-pack on remote side]:remote path' @@ -6851,7 +7091,7 @@ __git_setup_fetch_options () { '--submodule-prefix=-[prepend to paths printed in informative messages]:submodule prefix path:_files -/' '(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' - '(-q --quiet)--progress[output progress information]') + '(-q --quiet)--progress[force progress reporting]') } (( $+functions[__git_setup_apply_options] )) || @@ -7160,7 +7400,7 @@ _git() { if (( CURRENT > 2 )); then local -a aliases local -A git_aliases - local k v + local a k v aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) for a in ${aliases}; do k="${${a/$'\n'*}/alias.}" -- cgit v1.2.3 From ef64b6a929b8e485433308f19ec4382514d0f471 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 15 Aug 2016 12:06:58 +0200 Subject: 39040: Completion/…/_git: fix missing backslashes in 39036 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Completion/Unix/Command/_git | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 78f056435..ac4c90e75 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -753,7 +753,7 @@ _git-diff () { _arguments -C -s \ $* \ $diff_options \ - '(--exit-code)--quiet[disable all output]' + '(--exit-code)--quiet[disable all output]' \ $diff_stage_options \ '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ @@ -849,7 +849,7 @@ _git-fetch () { _arguments -C -S -s \ $fetch_options \ - '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' + '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ '*:: :->repository-or-group-or-refspec' && ret=0 -- cgit v1.2.3 From 31dc8b52b588e34b292aad2e35c7f9168c4448ee Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 19 Aug 2016 19:11:07 +0200 Subject: 39072: minor tweaks --- ChangeLog | 2 ++ Completion/Unix/Command/_git | 12 ++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index f83aa056d..8b374d6cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-08-19 Oliver Kiddle + * 39072: Completion/Unix/Command/_git: minor tweaks + * 39071: Completion/Solaris/Command/_beadm, Completion/Solaris/Command/_svcs, Completion/Unix/Command/_sort Completion/Solaris/Command/_coreadm, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ac4c90e75..f4011aa28 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -249,11 +249,7 @@ _git-bisect () { ;; esac ;; - (${(j.|.)~good}) - _arguments \ - ': :__git_commits' && ret=0 - ;; - (${(j.|.)~good}|skip) + (${(j.|.)~bad}|${(j.|.)~good}|skip) # TODO: skip can take revlists. _arguments \ '*: :__git_commits' && ret=0 @@ -991,7 +987,7 @@ _git-grep () { '(-A --after-context)'{-A+,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ '(-B --before-context)'{-B+,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ - '--threads=[use specified number of threads]:threads' \ + '--threads=[use specified number of threads]:number of threads' \ '(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ '(1)*-f+[read patterns from given file]:pattern file:_files' \ @@ -1926,7 +1922,7 @@ _git-tag () { _arguments -A '-*' \ - creation \ '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ - '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create an signed and annotated tag]' \ + '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create a signed and annotated tag]' \ '(-a --annotate -s --sign)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '(-f --force)'{-f,--force}'[replace existing tag]' \ '--create-reflog[create a reflog]' \ @@ -4452,7 +4448,7 @@ _git-index-pack () { '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ - '--threads=[specify number of threads to use]:threads' \ + '--threads=[specify number of threads to use]:number of threads' \ ':pack file:_files -g "*.pack(-.)"' } -- cgit v1.2.3 From c8b228b1ea99d6c9d893b72b2fe05eaf4a16a10f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 22 Aug 2016 03:38:08 +0000 Subject: unposted: _git-config: sendemail.smtpserver: Correct tags. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index d3a7d3356..39d0aa033 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-08-22 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-config: + sendemail.smtpserver: Correct tags. + * 39046 + 39061: Completion/Base/Completer/_external_pwds, Completion/Zsh/Type/_history_modifiers, Doc/Zsh/contrib.yo, Doc/Zsh/expn.yo, Functions/MIME/zsh-mime-handler, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f4011aa28..4a7c9b4ca 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7372,7 +7372,7 @@ __git_sendemail_suppresscc_values () { (( $+functions[__git_sendmail_smtpserver_values] )) || __git_sendmail_smtpserver_values() { - _alternative "smtp hosts:host:_hosts" "sendmail command: :_absolute_command_paths" + _alternative "hosts:smtp host:_hosts" "commands: :_absolute_command_paths" } (( $+functions[__git_colors] )) || -- cgit v1.2.3 From 18aa25c75d84b86be15a934554d3c829926a4066 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 22 Aug 2016 11:54:04 +0200 Subject: unposted (c.f. Mikael: 39078): fix for git blame terms --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 39d0aa033..3c54cb9ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-08-22 Oliver Kiddle + + * unposted (c.f. Mikael: 39078): Completion/Unix/Command/_git: + fix for git blame terms + 2016-08-22 Daniel Shahaf * unposted: Completion/Unix/Command/_git: _git-config: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4a7c9b4ca..304d6eb59 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -194,8 +194,8 @@ _git-bisect () { declare -A opt_args local good bad - if good=$(_call_program commands git terms --term-good); then - bad=$(_call_program commands git terms --term-bad) + if good=$(_call_program commands git bisect terms --term-good); then + bad=$(_call_program commands git bisect terms --term-bad) else good=( good old ) bad=( new bad ) fi @@ -249,7 +249,7 @@ _git-bisect () { ;; esac ;; - (${(j.|.)~bad}|${(j.|.)~good}|skip) + (${(~j.|.)bad}|${(~j.|.)good}|skip) # TODO: skip can take revlists. _arguments \ '*: :__git_commits' && ret=0 -- cgit v1.2.3 From 4d995160e42e875c714263d210df714160d200d4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 23 Aug 2016 23:15:39 +0000 Subject: 39094: _git-config: When an option is unknown, complete its value to the set value. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index bba59595a..c661cafe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-08-24 Daniel Shahaf + + * 39094: Completion/Unix/Command/_git: _git-config: When an + option is unknown, complete its value to the set value. + 2016-08-23 Jun-ichi Takimoto * 39087: Src/builtin.c, Src/utils.c: fix 'conditionally diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 304d6eb59..a9c0cc8d2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2597,7 +2597,7 @@ _git-config () { # If $key isn't an instance of a known foo.*.bar:baz $git_options entry... if ! (( ${+git_options[(r)(#i)${(b)key%%.*}.[*].${(b)key##*.}:*]} )); then # ... then add it. - git_options+="${key}:unknown option name" + git_options+="${key}:unknown option name::->unknown" fi else # $key is of the form "foo.bar" where 'foo' is known @@ -2606,7 +2606,7 @@ _git-config () { continue fi else - git_options+="${key}:unknown option name" + git_options+="${key}:unknown option name::->unknown" fi done } @@ -3207,6 +3207,10 @@ _git-config () { 'values:value:(user)' \ 'umasks: :__git_guard_number umask' && ret=0 ;; + (unknown) + _message "$line[1] option value" + compadd - $current && ret=0 + ;; esac ;; (*) -- cgit v1.2.3 From 317c96b64f43688a6be08a8b1c93b6ab4eed662c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 25 Aug 2016 00:59:08 +0000 Subject: 39102: __git_recent_branches: Optimise. This improves performance from 0.6s to 0.04s (+93%) on one of Daniel Hahler's repositories. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 42 +++++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index c661cafe3..b85cc1f92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-08-25 Daniel Shahaf + + * 39102: Completion/Unix/Command/_git: __git_recent_branches: + Optimise. + 2016-08-24 Daniel Shahaf * 39094: Completion/Unix/Command/_git: _git-config: When an diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a9c0cc8d2..afa3bcb4a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6054,35 +6054,39 @@ __git_recent_branches__names() # # See workers/38592 for an equivalent long-hand implementation, and the rest # of that thread for why this implementation was chosen instead. + # + # Note: since we obtain the "from" part of the reflog, we only obtain heads, not tags. reply=(${${(u)${${(0)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs')"}#checkout: moving from }%% *}:#[[:xdigit:]](#c40)}) } (( $+functions[__git_recent_branches] )) || __git_recent_branches() { local -a branches descriptions - local branch description local -a reply + local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/ refs/tags/')"}"#refs/(heads|tags)/} ) - __git_recent_branches__names \ - ; for branch in $reply - do - # ### We'd want to convert all $reply to $descriptions in one shot, - # ### with this: - # ### array=("${(ps:\0:)"$(_call_program descriptions git --no-pager log --no-walk=unsorted -z --pretty=%s ${(q)reply} --)"}") - # ### , but git croaks if any of the positional arguments is a ref name - # ### that has been deleted. (So does 'git rev-parse'.) - # ### Hence, we resort to fetching the descriptions one-by-one. - # ### This would be costly if fork() is expensive. - description="$(_call_program description git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branch} --)" - - # If the ref has been deleted, $description would be empty. - if [[ -n "$description" ]]; then - branches+=$branch - descriptions+="${branch//:/\:}:${description}" - fi + # 1. Obtain names of recently-checked-out branches from the reflog. + # 2. Remove ref names that that no longer exist from the list. + # (We must do this because #3 would otherwise croak on them.) + __git_recent_branches__names; branches=( ${(@)reply:*valid_ref_names_munged} ) + + # 3. Obtain log messages for all of them in one shot. + descriptions=( ${(f)"$(_call_program all-descriptions git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branches} --)"} ) + + if (( $#branches != $#descriptions )); then + # ### Trouble... + zle -M "__git_recent_branches: \$#branches != \$#descriptions" + return 1 + fi + + # 4. Synthesize the data structure _describe wants. + local -a branches_colon_descriptions + local branch description + for branch description in ${branches:^descriptions} ; do + branches_colon_descriptions+="${branch//:/\:}:${description}" done - _describe -V -t recent-branches "recent branches" descriptions branches + _describe -V -t recent-branches "recent branches" branches_colon_descriptions } -- cgit v1.2.3 From c2592b4f7278cb9e3ce3cd663fb5effec570e7d4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 30 Aug 2016 03:36:48 +0000 Subject: 39122: __git_recent_branches: Silence warning on an edge case. (The warning was correct; there is no functional change, though.) --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 4d2de8d86..866e2add1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-08-31 Daniel Shahaf + + * 39122: Completion/Unix/Command/_git: __git_recent_branches: + Silence warning on an edge case. + 2016-08-30 Daniel Shahaf * 39108: Completion/Unix/Command/_postfix: Support diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index afa3bcb4a..8d3bd6307 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6070,7 +6070,14 @@ __git_recent_branches() { # (We must do this because #3 would otherwise croak on them.) __git_recent_branches__names; branches=( ${(@)reply:*valid_ref_names_munged} ) - # 3. Obtain log messages for all of them in one shot. + # 3. Early out if no matches. + if ! (( $+branches[1] )); then + # This can happen in a fresh repository (immediately after 'clone' or 'init') before + # any 'checkout' commands were run in it. + return 1 + fi + + # 4. Obtain log messages for all of them in one shot. descriptions=( ${(f)"$(_call_program all-descriptions git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branches} --)"} ) if (( $#branches != $#descriptions )); then @@ -6079,7 +6086,7 @@ __git_recent_branches() { return 1 fi - # 4. Synthesize the data structure _describe wants. + # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions local branch description for branch description in ${branches:^descriptions} ; do -- cgit v1.2.3 From 48c20d74a7aa5e91619d84fc36f9bd7831eb4174 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 3 Sep 2016 12:31:22 +0200 Subject: 39165: update options to correspond to latest versions of software in various functions --- ChangeLog | 9 +++++ Completion/Linux/Command/_ss | 4 ++- Completion/Unix/Command/_ant | 1 + Completion/Unix/Command/_dmidecode | 17 +++++---- Completion/Unix/Command/_espeak | 73 ++++++++++++++++++++++---------------- Completion/Unix/Command/_git | 27 ++++++++++---- Completion/Unix/Command/_look | 34 +++++++++++++----- Completion/Unix/Command/_md5sum | 5 +-- Completion/Unix/Command/_patch | 31 +++++++++------- Completion/Unix/Command/_prove | 2 +- Completion/Unix/Command/_tin | 2 ++ 11 files changed, 138 insertions(+), 67 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 0b6d6b3de..93051dd11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2016-09-03 Oliver Kiddle + + * 39165: Completion/Unix/Command/_dmidecode, + Completion/Unix/Command/_ant, Completion/Linux/Command/_ss, + Completion/Unix/Command/_espeak, Completion/Unix/Command/_git, + Completion/Unix/Command/_prove, Completion/Unix/Command/_tin, + Completion/Unix/Command/_patch, Completion/Unix/Command/_look, + Completion/Unix/Command/_md5sum: update options + 2016-09-02 Daniel Shahaf * unposted: Completion/Unix/Command/_postfix: _postfix_queue_id: diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index 520fd4b5a..90d83a4c4 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -32,7 +32,9 @@ _arguments -C -s \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ "($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \ - "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink)' \ + "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix)' \ + "($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \ + "($info -H --no-header)"{-H,--no-header}'[suppress header line]' \ "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram' \ "($info -D)"{-D,--diag=}'[dump raw info to file]:file:_files' \ "($info -F)"{-F,--filter=}'[read filter information from a file]:file:_files' \ diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index ee9f7d910..195a54374 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -41,6 +41,7 @@ _arguments -C \ '(- *)-version[display version information]' \ '(- *)-diagnostics[print information helpful to diagnosis or report problems]' \ '(-q -quiet)'{-q,-quiet}'[be extra quiet]' \ + '(-s -silent)'{-s,-silent}'[print nothing but task outputs and build failures]' \ '(-v -verbose)'{-v,-verbose}'[be extra verbose]' \ '(-d -debug)'{-d,-debug}'[print debugging information]' \ '(-e -emacs)'{-e,-emacs}'[produce logging information without adornments]' \ diff --git a/Completion/Unix/Command/_dmidecode b/Completion/Unix/Command/_dmidecode index 0ff56113d..5701a9403 100644 --- a/Completion/Unix/Command/_dmidecode +++ b/Completion/Unix/Command/_dmidecode @@ -1,10 +1,13 @@ #compdef dmidecode -_arguments \ - '(-d --dev-mem)'{-d,--dev-mem}':memory device:_files' \ +_arguments -s \ + '(-d --dev-mem --from-dump)'{-d+,--dev-mem=}'[read memory from specified file]:memory device [/dev/mem]:_files' \ + '(-)'{-h,--help}'[display usage information]' \ '(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \ - '(-t --type -u --dump -s --string)'{-s,--string}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ - '(-t --type)'{-t,--type}':types to display:(bios system baseboard chassis processor memory cache connector slot)' \ - '(-q --quiet -u --dump -s --string)'{-u,--dump}'[do not decode]' \ - '(-h --help)'{-h,--help}'[display usage information]' \ - '(-V --version)'{-V,--version}'[display version information]' + '(--type -u --dump --dump-bin -s --string)'{-s+,--string=}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ + '*(-s --string --dump-bin)'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ + '(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \ + '--dump-bin=[dump DMI data to a binary file]:file:_files' \ + '(-d --dev-mem)--from-dump=[read DMI data from a binary file]:file:_files' \ + "--no-sysfs[don't attempt to read DMI data from sysfs files]" \ + '(-)'{-V,--version}'[display version information]' diff --git a/Completion/Unix/Command/_espeak b/Completion/Unix/Command/_espeak index d868c7912..4ab443bba 100644 --- a/Completion/Unix/Command/_espeak +++ b/Completion/Unix/Command/_espeak @@ -1,33 +1,46 @@ #compdef espeak -#TODO: complete non-existing filenames for -w and --phonout -#TODO: describe special cases for -k -#TODO: complete --punct better? +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args -_arguments \ - '-h[help]' \ - '-f[file to speak]:text file:_files' \ - '--stdin[speak from stdin]' \ - '-q[quiet, no sound output]' \ - '-a[amplitude]:integer:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 -18 19 20)' \ - '-l[line length]:integer: ' \ - '-p[pitch]:integer:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 -19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 -43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 -67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 -91 92 93 94 95 96 97 98 99)' \ - '-s[speed]:words per minute: ' \ - '-v[voice]:voice name:(afrikaans bosnian catalan czech welsh-test danish-test german greek default en-scottish english lancashire english_rp english_wmids english-us en-westindies esperanto spanish spanish-latin-american finnish french french greek-ancient hindi-test croatian hungarian armenian armenian-west indonesian-test icelandic-test italian test/jbo kurdish latin latvian macedonian-test dutch-test norwegian-test test/pap polish brazil portugal romanian russian_test slovak albanian serbian swedish swahihi-test tamil turkish vietnam-test Mandarin cantonese-test)' \ - '-b[8-bit text]' \ - '-m[SSML or other XML text]' \ - '-w[wav output]:filename: ' \ - '-x[output phoneme mnemonics]' \ - '-X[output phoneme mnemonics and translation trace]' \ - '--stdout[output speech to stdout]' \ - '-k[capital letter indication]:integer:' \ - '--punct=-::characters: ' \ - '--voices=-[list available voices]::language code:(af bs ca cs cy da de el en en-sc en-uk en-uk-north en-uk-rp en-uk-wmids en-us en-wi eo es es-la fi fr fr-be grc hi hr hu hy hy id is it jbo ku la lv mk nl no pap pl pt pt-pt ro ru sk sq sr sv sw ta tr vi zh zh-yue)' \ - '--path=-[espeak-data path]:path:_files -/' \ - '--compile=-[compile]::voicename or debug: ' \ - '--phonout=-[output filename for -x/-X]:filename: ' +_arguments -C \ + '(1 --stdin)-f+[specify file to speak]:text file:_files' \ + '(1 -f)--stdin[speak from stdin]' \ + '(-q)-a+[specify amplitude]:amplitude (0-200) [100]' \ + '(-q)-g+[specify pause between words]:pause (10ms) [1]' \ + '-k[capital letter indication]:integer:((1\:sound 2\:the\ word\ "capitals"))' \ + '-l[specify line length below which clause is ended]:length' \ + '(-q)-p+[specify pitch adjustment]:adjustment (0-99)' \ + '(-q)-s+[specify speed]:speed (words per minute) [175]' \ + '(-q)-v+[voice]:voice name:->voices' \ + '(--stdout -q)-w+[write speech to wav file]:wav file:_files -g "*.wav(-.)"' \ + '-b+[specify input encoding]:encoding:((1\:UTF-8 2\:8-bit 3\:16-bit))' \ + '-m[interpret SSML markup, ignore other XML]' \ + '(-a -g -p -s -v -w -z --split --stdout)-q[quiet, no sound output]' \ + '(-x --ipa)-x[output phoneme mnemonics]' \ + '(-X --ipa)-X[output phoneme mnemonics and translation trace]' \ + '(-q)-z[suppress final sentence pause at the end of the text]' \ + '--compile=-[compile pronunciation rules and dictionary]::voicename or debug' \ + '(-x -X)--ipa=-[output phonemes using International Phonetic Alphabet]::options:((1\:use\ ties 2\:use\ ZWJ 3\:separate\ with\ _))' \ + '--path=[specify espeak-data path]:path:_files -/' \ + '--pho[output mbrola phoneme data]' \ + '--phonout=[output filename for -x/-X/--ipa]:filename:_files' \ + '--punct=-[speak names of punctuation characters]::characters' \ + '(-q --stdout)--split=[periodically start new wav file]:period (minutes)' \ + '(-w -q --split)--stdout[output speech to stdout]' \ + '--voices=-[list available voices]::language code:->languages' \ + '(-)'{-h,--help}'[display help information]' \ + '(-)--version[display version information]' && ret=0 + +case $state in + voices) + _wanted voices expl voice compadd \ + ${${${(f)"$(_call_program voices $words[1] --voices)"}[2,-1]#?(#c22)}%% *} && ret=0 + ;; + languages) + _wanted languages expl language compadd \ + ${${${(f)"$(_call_program voices $words[1] --voices)"}[2,-1]#?(#c4)}%% *} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8d3bd6307..2178b827f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1353,6 +1353,7 @@ _git-push () { '(--no-signed --sign)--signed[GPG sign the push]' \ "(--sign --signed)--no-signed[don't GPG sign the push]" \ '--atomic[request atomic transaction on remote side]' \ + '(-o --push-option)'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :__git_any_repositories' \ @@ -1767,6 +1768,7 @@ _git-submodule () { '(--merge --rebase)--checkout[checkout commit recorded in the superproject in the submodule on a detached HEAD]' \ '(--checkout --rebase)--merge[merge commit recorded in superproject into current branch of submodule]' \ '(--checkout --merge)--rebase[rebase current branch onto commit recorded in superproject]' \ + '--no-recommend-shallow[ignore submodule..shallow from .gitmodules]' \ '--reference=[remote repository to clone]: :__git_any_repositories' \ '--recursive[traverse submodules recursively]' \ '--remote[use the status of the submodule''s remote-tracking branch]' \ @@ -1968,6 +1970,8 @@ _git-worktree() { add:'create a new working tree' prune:'prune working tree information' list:'list details of each worktree' + lock:'prevent a working tree from being pruned' + unlock:'allow working tree to be pruned, moved or deleted' ) _describe -t commands command commands && ret=0 @@ -1986,6 +1990,7 @@ _git-worktree() { '(-B --detach)-b+[create a new branch]: :__git_branch_names' \ '(-b --detach)-B+[create or reset a branch]: :__git_branch_names' \ '(-b -B)--detach[detach HEAD at named commit]' \ + '--no-checkout[suppress file checkout in new worktree]' \ ':path:_files' $args && ret=0 ;; (prune) @@ -1997,6 +2002,14 @@ _git-worktree() { (list) _arguments '--porcelain[machine-readable output]' && ret=0 ;; + (lock) + _arguments -C '--reason=[specify reason for locking]:reason' ': :->worktrees' && ret=0 + [[ -z $state ]] && return ret + ;& + (unlock) + _wanted directories expl 'working tree' compadd -S ' ' -f -M 'r:|/=* r:|=*' \ + ${${(M)${(f)"$(_call_program directories git worktree list --porcelain)"}:#worktree*}#* } + ;; esac ;; esac @@ -3539,8 +3552,8 @@ _git-remote () { _git-repack () { # TODO: --quiet is undocumented. _arguments -s \ - '(-A)-a[pack all objects into a single pack]' \ - '(-a)-A[pack all objects into a single pack, but unreachable objects become loose]' \ + '(-A --unpack-unreachable)-a[pack all objects into a single pack]' \ + '(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \ '-d[remove redundant packs after packing]' \ "--unpack-unreachable=[with -A, don't loosen objects older than specified date]:date" \ '-f[pass --no-reuse-delta option to git pack-objects]' \ @@ -3550,6 +3563,7 @@ _git-repack () { '(-l --local)'{-l,--local}'[pass --local option to git pack-objects]' \ '(-b --write-bitmap-index)'{-b,--write-bitmap-index}'[write a bitmap index]' \ "--unpack-unreachable=[with -A, don't loosen objects older than specified time]:time" \ + '(-k --keep-unreachable)'{-k,--keep-unreachable}'[with -a, repack unreachable objects]' \ '--window=[number of objects to consider when doing delta compression]:number of objects' \ '--window-memory=[scale window size dynamically to not use more than specified amount of memory]: : __git_guard_bytes' \ '--depth=[maximum delta depth]:maximum delta depth' \ @@ -3678,6 +3692,7 @@ _git-fsck () { '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '--lost-found[write dangling objects into .git/lost-found]' \ '--progress[show progress]' \ + '--name-objects[show verbose names for reachable objects]' \ '*: :__git_objects' } @@ -4548,6 +4563,7 @@ _git-pack-objects () { '(: --max-pack-size)--stdout[output pack to stdout]' \ '--include-tag[include unasked-for annotated tags if object they reference is included]' \ '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \ + '--pack-loose-unreachable[pack loose unreachable objects]' \ '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \ '--include-tag[include tag objects that refer to objects to be packed]' \ $thin_opt \ @@ -5205,12 +5221,11 @@ _git-upload-archive () { (( $+functions[_git-upload-pack] )) || _git-upload-pack () { - # TODO: --advertise-refs is undocumented. - # TODO: --stateless-rpc is undocumented. _arguments -S -A '-*' \ + '--stateless-rpc[quit after a single request/response exchange]' \ + '--advertise-refs[exit immediately after initial ref advertisement]' \ "--strict[don't try /.git/ if is not a git directory]" \ - '--timeout=-[interrupt transfer after given number of seconds of inactivity]: :__git_guard_number "inactivity timeout"' \ - --advertise-refs --stateless-rpc \ + '--timeout=-[interrupt transfer after period of inactivity]: :__git_guard_number "inactivity timeout (seconds)"' \ ': :_directories' } diff --git a/Completion/Unix/Command/_look b/Completion/Unix/Command/_look index 24a016af4..be8cf8c14 100644 --- a/Completion/Unix/Command/_look +++ b/Completion/Unix/Command/_look @@ -1,16 +1,34 @@ #compdef look -local curcontext="$curcontext" state line expl ret=1 +local curcontext="$curcontext" state line expl args sep='+' ret=1 typeset -A opt_args -_arguments -C -s \ - '-t+[termination character]:termination character:' \ - '-f[case insensitive]' \ - '-d[dictionary order]' \ - ':string:->string' \ - ':dictionary file:_files' && ret=0 +case $OSTYPE in + linux*) + args=( + '(2 -a --alternative)'{-a,--alternative}'[use alternative dictionary file]' + '(-d --alphanum)'{-d,--alphanum}'[dictionary order]' + '(-f --ignore-case)'{-f,--ignore-case}'[case insensitive]' + '(-t --terminate)'{-t+,--terminate=}'[specify termination character]:termination character' + '(-)'{-h,--help}'[display help information]' + '(-)'{-V,--version}'[display version information]' + ) + ;; + solaris*) sep='-' ;& + *) + args=( -A "-*" + "-t${sep}[specify termination character]:termination character" + '-f[case insensitive]' + '-d[dictionary order]' + ) + ;; +esac + +_arguments -C -s -S $args \ + '1:string:->string' \ + '2:dictionary file:_files' && ret=0 [[ -n "$state" && ! -prefix - ]] && _wanted values expl 'word prefix' \ - compadd - $(_call_program words $words[1] '"$PREFIX"' 2>/dev/null) && return + compadd - $(_call_program words $words[1] '"$PREFIX"') && return return ret diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum index c881a4e6d..073e6beba 100644 --- a/Completion/Unix/Command/_md5sum +++ b/Completion/Unix/Command/_md5sum @@ -5,10 +5,11 @@ _arguments -S \ '(-c --check)'{-c,--check}'[read MD5 sums from the FILEs and check them]' \ '--tag[create a BSD-style checksum]' \ '(-t --text)'{-t,--text}'[read in text mode]' \ + "--ignore-missing[don't fail or report status for missing files]" \ '(-q --quiet)'{-q,--quiet}"[don't print OK for each successfully verified file]" \ '--status[no output, status code shows success]' \ '--strict[exit non-zero for improperly formatted checksum lines]' \ '(-w --warn)'{-w,--warn}'[warn about improperly formatted checksum lines]' \ - '--help[display help and exit]' \ - '--version[output version information and exit]' \ + '(-)--help[display help and exit]' \ + '(-)--version[output version information and exit]' \ '*:files:_files' diff --git a/Completion/Unix/Command/_patch b/Completion/Unix/Command/_patch index c0df00c00..c2725d46b 100644 --- a/Completion/Unix/Command/_patch +++ b/Completion/Unix/Command/_patch @@ -9,8 +9,7 @@ if (( ! $+_patch_args )); then [[ "$help" = *--[^h]* || "$help" = *\[-c\|-e\|-n\]* ]] && arg=+ optionmap=( - '*\[-p\[strip-count\]\]*' '(--strip)-p-[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}" - '*( -p NUM[, ]|\[-p num\])*' '(--strip)-p+[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}" + '*( -p NUM[, ]|\[-p (num|strip-count)\])*' '(--strip)-p+[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}" '*\[--strip\[=strip-count\]\]*' '(-p)--strip=-[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}" '* --strip=NUM[, ]*' '(-p)--strip=[number of path prefix components to strip]:number of path prefix components to strip:'"{$comp_p}" @@ -35,8 +34,8 @@ if (( ! $+_patch_args )); then '*(\[-[a-zA-Z]#R[a-zA-Z]#\]| -R[, ])*' '(--reverse)-R[reverse mode]' '*(\[--reverse\]| --reverse[, ])*' '(-R)--reverse[reverse mode]' - '*(\[-i patchfile\]| -i PATCHFILE[, ])*' '(--input)-i+[patch file]:patch file:_files' - '* --input=PATCHFILE[, ]*' '(-i)--input=[patch file]:patch file:_files' + '*(\[-i patchfile\]| -i PATCHFILE[, ])*' '*-i+[specify input patch file]:patch file:_files' + '* --input=PATCHFILE[, ]*' '*--input=[specify input patch file]:patch file:_files' '*(\[-o out-file\]| -o FILE[, ]|\[-o outfile\])*' "(--output)-o${arg}[output file]:output file:_files" '*(\[--output=out-file\]| --output=FILE[, ])*' '(-o)--output=[output file]:output file:_files' @@ -46,6 +45,8 @@ if (( ! $+_patch_args )); then '*(\[-D symbol\]| -D NAME[, ]|\[-D define\])*' '(--ifdef)-D+[cpp symbol]:symbol:' '*(\[--ifdef=symbol\]| --ifdef=NAME[, ])*' '(-D)--ifdef=[cpp symbol]:symbol:' + '* --merge*' '(--reject-file --reject-format -r)--merge[merge using conflict markers instead of creating reject files]' + '*(\[-[a-zA-Z]#E[a-zA-Z]#\]| -E[, ])*' '(--remove-empty-files)-E[remove empty files]' '*(\[--remove-empty-files\]| --remove-empty-files[, ])*' '(-E)--remove-empty-files[remove empty files]' @@ -62,6 +63,7 @@ if (( ! $+_patch_args )); then '* --no-backup-if-mismatch[, ]*' '(--backup-if-mismatch)--no-backup-if-mismatch[back up only if otherwise requested]' '*(\[-V {numbered,existing,simple}\]| -V STYLE[, ])*' "(--version-control)-V${arg}[backup method]:backup method:(numbered existing simple)" + '*\[-V t \| nil \| never\]*' '(-B)-V+[specify backup method]:backup method:((t\:numbered nil\:existing never\:simple))' '*(\[--version-control={numbered,existing,simple}\]| --version-control=STYLE[, ])*' '(-V)--version-control=[backup method]:backup method:(numbered existing simple)' '*(\[-B backup-prefix\]| -B PREFIX[, ])*' "(--prefix)-B${arg}[specify backup prefix]:backup prefix:" @@ -69,6 +71,7 @@ if (( ! $+_patch_args )); then '* -Y PREFIX[, ]*' '(--basename-prefix)-Y+[specify backup basename prefix]:backup basename prefix:' '* --basename-prefix=PREFIX[, ]*' '(-Y)--basename-prefix=[specify backup basename prefix]:backup basename prefix:' '*\[-b backup-ext\]*' "( -z --suffix)-b${arg}[specify backup suffix]:backup suffix:(.bak)" + '*\[-z backup-ext\]*' '(--suffix)-z+[specify backup suffix]:backup suffix [.orig]:(.bak)' '* -z SUFFIX[, ]*' '(-b --suffix)-z+[specify backup suffix]:backup suffix:(.bak)' '*(\[--suffix=backup-ext\]| --suffix=SUFFIX[, ])*' '(-b -z )--suffix=[specify backup suffix]:backup suffix:(.bak)' @@ -90,24 +93,28 @@ if (( ! $+_patch_args )); then '*(\[--silent\]|--silent[, ])*' '(-s --quiet )--silent[silent mode]' '* --verbose[, ]*' '--verbose[verbose mode]' - '* --dry-run[, ]*' '--dry-run[don'\''t actually change files]' - '* --posix[, ]*' '--posix[POSIX mode]' + + '*(\[-[a-zA-Z]#C[a-zA-Z]#\])*' '(--check)-C[only check that the patch would apply cleanly]' + '*\[--check\]*' '(-C)--check[only check that the patch would apply cleanly]' + '* --dry-run[, ]*' '--dry-run[only check that the patch would apply cleanly]' + + '*--posix*' '--posix[POSIX mode]' '*(\[-d directory\]| -d DIR[, ]|\[-d dir\])*' '(--directory)-d+[change the working directory]:chdir to:_files -/' '*(\[--directory=directory\]| --directory=DIR[, ])*' '(-d)--directory=[change the working directory]:chdir to:_files -/' + '* --reject-format=*' '--reject-format=[specify format of rejects]:format:(context unified)' + '* --read-only=*' '--read-only=[specify how to handle read-only input files]:behaviour [warn]: (ignore warn fail)' + '* --binary[, ]*' '--binary[binary mode]' - '*(\[-[a-zA-Z]#v[a-zA-Z]#\]| -v[, ])*' '(--version)-v[print version]' - '*(\[--version\]| --version[, ])*' '(-v)--version[print version]' - '* --help[, ]*' '--help[print help message]' + '*(\[-[a-zA-Z]#v[a-zA-Z]#\]| -v[, ])*' '(-)-v[print version]' + '*(\[--version\]| --version[, ])*' '(-)--version[print version]' + '* --help[, ]*' '(-)--help[print help message]' '*\[-[a-zA-Z]#S[a-zA-Z]#\]*' '*-S[ignore this patch]' '*\[--skip\]*' '*--skip[ignore this patch]' - '*(\[-[a-zA-Z]#C[a-zA-Z]#\])*' '(--check)-C[check only]' - '*\[--check\]*' '(-C)--check[check only]' - '*\[--index-first\]*' '--index-first[take Index: line precedence]' '* --use-index-line *' '--use-index-line[deal with Index: line]' diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove index 1f21423e6..17b48a54d 100644 --- a/Completion/Unix/Command/_prove +++ b/Completion/Unix/Command/_prove @@ -7,7 +7,7 @@ _arguments \ '(- *)'{-h,--help}'[display help and exit]' \ '(- *)'{-H,--man}'[display longer help and exit]' \ - '(- *)--version[display version and exit]' \ + '(- *)'{-V,--version}'[display version and exit]' \ '(--quiet -q -Q --QUIET)'{-v,--verbose}'[print all test lines]' \ {-l,--lib}'[add lib to path]' \ {-b,--blib}'[add blib to path]' \ diff --git a/Completion/Unix/Command/_tin b/Completion/Unix/Command/_tin index c63ccd9e6..61d203d1f 100644 --- a/Completion/Unix/Command/_tin +++ b/Completion/Unix/Command/_tin @@ -3,6 +3,8 @@ local newshosts expl state line curcontext="$curcontext" ret=1 _arguments -C -s \ + '(-6)-4[force connecting via IPv4]' \ + '(-4)-6[force connecting via IPv6]' \ '-a[toggle color flag]' \ '-A[force authentication on connect]' \ '-c[mark all news as read in subscribed groups]' \ -- cgit v1.2.3 From ec0c788709ae5ea345fdc9a12321a95c2603ce12 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 14 Sep 2016 05:27:14 +0000 Subject: unposted: _git: Permit multiple -c options. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 0a53e3b4c..6ce876e08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-09-14 Daniel Shahaf + + * unposted: Completion/Unix/Command/_git: Permit multiple + -c options. + 2016-09-13 Oliver Kiddle * 39307: Completion/Unix/Command/_vim, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2178b827f..a00e1d7ac 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7462,7 +7462,7 @@ _git() { '(- :)--version[display version information]' \ '(- :)--help[display help message]' \ '-C[run as if git was started in given path]: :_directories' \ - '-c[pass configuration parameter to command]:parameter' \ + '*-c[pass configuration parameter to command]:parameter' \ '--exec-path=-[path containing core git-programs]:: :_directories' \ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ '(: -)--info-path[print the path where the info files are installed and exit]' \ -- cgit v1.2.3 From 13d0b278be9f9f10655a53a88b863351d85b523d Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 30 Sep 2016 09:57:50 +0200 Subject: 39514: pass on --git-dir when calling git to get completion matches --- ChangeLog | 2 ++ Completion/Unix/Command/_git | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 6936d137e..8450407c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-09-30 Oliver Kiddle + * 39514: Completion/Unix/Command/_git: handle --git-dir + * 39513: Completion/Unix/Command/_doas: new doas completion * 39464: Completion/Solaris/Command/_fmadm: fix where lack diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index a00e1d7ac..80b2c55af 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7484,7 +7484,7 @@ _git() { ;; (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - + (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir] if ! _call_function ret _git-$words[1]; then if zstyle -T :completion:$curcontext: use-fallback; then _default && ret=0 -- cgit v1.2.3 From 7ad0001183688c56bd1edfc8fc08467e380910a4 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 28 Sep 2016 17:46:37 +0000 Subject: 39479 + 39481 minus _path_files hunk (see 39489): Completion: audit 'compset -P' calls to use shortest match where applicable, plus random drive-by tweaks. Found by grepping for patterns that can match needles of various lengths: :grep 'compset -[PS].*[\#^*()\|<>?~\]' Completion/ --- ChangeLog | 25 +++++++++++++++++++++++++ Completion/Debian/Command/_debfoster | 4 ++-- Completion/Linux/Command/_modutils | 2 +- Completion/Redhat/Command/_rpm | 2 +- Completion/Unix/Command/_ant | 2 +- Completion/Unix/Command/_cpio | 8 ++++---- Completion/Unix/Command/_cvs | 2 +- Completion/Unix/Command/_dbus | 2 +- Completion/Unix/Command/_git | 2 +- Completion/Unix/Command/_graphicsmagick | 2 +- Completion/Unix/Command/_growisofs | 4 ++-- Completion/Unix/Command/_gs | 2 +- Completion/Unix/Command/_gsettings | 2 +- Completion/Unix/Command/_head | 2 +- Completion/Unix/Command/_imagemagick | 2 +- Completion/Unix/Command/_java | 2 +- Completion/Unix/Command/_lp | 2 +- Completion/Unix/Command/_lzop | 3 ++- Completion/Unix/Command/_mount | 2 +- Completion/Unix/Command/_perl | 2 +- Completion/Unix/Command/_php | 2 +- Completion/Unix/Command/_rlogin | 4 ++-- Completion/Unix/Command/_ssh | 10 +++++----- Completion/Unix/Command/_tail | 2 +- Completion/Unix/Command/_w3m | 4 ++-- Completion/X/Command/_rdesktop | 3 +-- Completion/X/Command/_x_utils | 8 ++++++-- Completion/Zsh/Command/_fc | 2 +- Completion/Zsh/Type/_arrays | 2 +- Completion/Zsh/Type/_globflags | 3 +++ Completion/Zsh/Type/_ps1234 | 3 +++ Completion/Zsh/Type/_vars | 2 +- 32 files changed, 77 insertions(+), 42 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index aec3a20aa..e42620a6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2016-10-07 Daniel Shahaf + + * 39479 + 39481 minus _path_files hunk (see + 39489): Completion/Debian/Command/_debfoster, + Completion/Linux/Command/_modutils, + Completion/Redhat/Command/_rpm, Completion/Unix/Command/_ant, + Completion/Unix/Command/_cpio, Completion/Unix/Command/_cvs, + Completion/Unix/Command/_dbus, Completion/Unix/Command/_git, + Completion/Unix/Command/_graphicsmagick, + Completion/Unix/Command/_growisofs, Completion/Unix/Command/_gs, + Completion/Unix/Command/_gsettings, + Completion/Unix/Command/_head, + Completion/Unix/Command/_imagemagick, + Completion/Unix/Command/_java, Completion/Unix/Command/_lp, + Completion/Unix/Command/_lzop, Completion/Unix/Command/_mount, + Completion/Unix/Command/_perl, Completion/Unix/Command/_php, + Completion/Unix/Command/_rlogin, Completion/Unix/Command/_ssh, + Completion/Unix/Command/_tail, Completion/Unix/Command/_w3m, + Completion/X/Command/_rdesktop, Completion/X/Command/_x_utils, + Completion/Zsh/Command/_fc, Completion/Zsh/Type/_arrays, + Completion/Zsh/Type/_globflags, Completion/Zsh/Type/_ps1234, + Completion/Zsh/Type/_vars: Completion: audit 'compset -P' + calls to use shortest match where applicable, plus random + drive-by tweaks. + 2016-10-06 Peter Stephenson * Julien Cretin: 39579: Src/subst.c: position of \0 diff --git a/Completion/Debian/Command/_debfoster b/Completion/Debian/Command/_debfoster index 154d0e913..08a1078e2 100644 --- a/Completion/Debian/Command/_debfoster +++ b/Completion/Debian/Command/_debfoster @@ -26,10 +26,10 @@ _arguments -C \ && ret=0 if [[ -n "$state" ]]; then - if compset -P '*='; then + if compset -P 1 '*='; then case "$IPREFIX" in *(#i)(install|remove|info)cmd*) - _wanted values expl 'command string' _command && ret=0 + _wanted values expl 'command string' _cmdstring && ret=0 ;; *(#i)(keeperfile|dpkg(status|available))*) _wanted values expl 'metadata file' _files && ret=0 diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index 0732aa106..7de97f60e 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -123,7 +123,7 @@ _modutils() { ;; params) - if compset -P '*='; then + if compset -P 1 '*='; then _message -e value 'parameter value' else local params diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm index b2157bd48..b24213e3c 100644 --- a/Completion/Redhat/Command/_rpm +++ b/Completion/Redhat/Command/_rpm @@ -298,7 +298,7 @@ _rpm () { ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"} && ret=0 ;; relocate) - if compset -P '*='; then + if compset -P 1 '*='; then _description directories expl 'new path' else _description directories expl 'old path' diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 195a54374..19c252a4e 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -83,7 +83,7 @@ case $state in "classpath:$state:_path_files -r': ' -/" && ret=0 ;; property) - if compset -P '*='; then + if compset -P 1 '*='; then _default && ret=0 else _message -e properties 'property name' diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio index 6b07a214a..4027cc0ca 100644 --- a/Completion/Unix/Command/_cpio +++ b/Completion/Unix/Command/_cpio @@ -106,10 +106,10 @@ fi _arguments -C -s "$args[@]" && ret=0 if [[ $state = afile ]]; then - if compset -P '*:'; then - # TODO: doesn't need to be rsh. - _wanted files expl 'remote files' \ - compadd $(rsh ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) && ret=0 + if [[ $ig != gnu ]]; then + _files && ret=0 + elif compset -P 1 '*:'; then + _remote_files -- ssh && ret=0 elif compset -P '*@'; then _wanted hosts expl 'remote host name' _hosts && ret=0 else diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index 18383c33e..0552d2175 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -595,7 +595,7 @@ _cvs_tempdir() { (( $+functions[_cvs_user_variable] )) || _cvs_user_variable() { - if compset -P '*='; then + if compset -P 1 '*='; then _default else _message -e variables "variable" diff --git a/Completion/Unix/Command/_dbus b/Completion/Unix/Command/_dbus index b24a6e9a8..fd035743f 100644 --- a/Completion/Unix/Command/_dbus +++ b/Completion/Unix/Command/_dbus @@ -32,7 +32,7 @@ esac case $state in addresses) compset -P '*;' - if compset -P '*='; then + if compset -P 1 '*='; then _files && ret=0 else _message -e addresses address diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 80b2c55af..437036a9b 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1335,7 +1335,7 @@ _git-push () { '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \ - '(--force-with-lease --no-force-with-lease)--no-force-with-lease=-[cancel all previous force-with-lease specifications]' \ + '(--force-with-lease --no-force-with-lease)--no-force-with-lease[cancel all previous force-with-lease specifications]' \ '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \ '(:)--repo=[default repository to use]:repository:__git_any_repositories' \ '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \ diff --git a/Completion/Unix/Command/_graphicsmagick b/Completion/Unix/Command/_graphicsmagick index 150f5ae61..cc541d891 100644 --- a/Completion/Unix/Command/_graphicsmagick +++ b/Completion/Unix/Command/_graphicsmagick @@ -360,7 +360,7 @@ case "$words[2]" in '*:picture file:_imagemagick' && return if [[ "$state" = profile ]]; then - if compset -P '*:'; then + if compset -P 1 '*:'; then _files else _wanted prefixes expl 'profile type' compadd icc: iptc: diff --git a/Completion/Unix/Command/_growisofs b/Completion/Unix/Command/_growisofs index 36b45d5ba..f67961f24 100644 --- a/Completion/Unix/Command/_growisofs +++ b/Completion/Unix/Command/_growisofs @@ -116,7 +116,7 @@ _mkisofs_sparc_boot_images () { _mkisofs_pathspec () { local sep if (( $words[(I)-graft-points] )); then - if ! compset -P '*[^\\]\='; then + if ! compset -P 1 '*[^\\]\='; then sep='-qS=' fi fi @@ -335,7 +335,7 @@ else case "$state" in (devimg) - if compset -P \*=; then + if compset -P 1 '*='; then _files else _files -g "*(%,@)" diff --git a/Completion/Unix/Command/_gs b/Completion/Unix/Command/_gs index 22f3c789b..98ba14912 100644 --- a/Completion/Unix/Command/_gs +++ b/Completion/Unix/Command/_gs @@ -32,7 +32,7 @@ else fi ;; sname) - if compset -P '*='; then + if compset -P 1 '*='; then case "$IPREFIX" in *DEVICE\=) _wanted devices expl 'ghostscript device' \ diff --git a/Completion/Unix/Command/_gsettings b/Completion/Unix/Command/_gsettings index f47bbc6b1..72f015729 100644 --- a/Completion/Unix/Command/_gsettings +++ b/Completion/Unix/Command/_gsettings @@ -31,7 +31,7 @@ case $state in state='' ;; schemata) - if compset -P '*:'; then + if compset -P 1 '*:'; then _directories && ret=0 else _wanted schemata expl 'schema' compadd -M 'r:|.=* r:|=*' \ diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head index 4f956acdc..c76cce30e 100644 --- a/Completion/Unix/Command/_head +++ b/Completion/Unix/Command/_head @@ -32,7 +32,7 @@ case $state in sign='sign:sign:((-\:"print all but the last specified bytes/lines"' sign+=' +\:"print the first specified bytes/lines (default)"))' digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '*[0-9]'; then + if compset -P '[0-9]##'; then _alternative $mlt $digit && ret=0 elif [[ -z $PREFIX ]]; then _alternative $sign $digit && ret=0 diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick index 4a9b62a9b..c2c9dc478 100644 --- a/Completion/Unix/Command/_imagemagick +++ b/Completion/Unix/Command/_imagemagick @@ -364,7 +364,7 @@ case "$service" in '*:picture file:_imagemagick' && return if [[ "$state" = profile ]]; then - if compset -P '*:'; then + if compset -P 1 '*:'; then _files else _wanted prefixes expl 'profile type' compadd icc: iptc: diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index 2aef15a25..7d5bd42e5 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -578,7 +578,7 @@ encoding) ;; property) - if compset -P '*='; then + if compset -P 1 '*='; then _default && return else _message -e property-names 'property name' diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index 8da84a180..63fbab78a 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -44,7 +44,7 @@ _lp_job_options() # The program specified by the style list-printer-options should list jobs in # the same style as lpoptions -l. - if compset -P '*='; then + if compset -P 1 '*='; then # List values for the option case ${IPREFIX%=} in (media) diff --git a/Completion/Unix/Command/_lzop b/Completion/Unix/Command/_lzop index 6f09cf47e..7661d117c 100644 --- a/Completion/Unix/Command/_lzop +++ b/Completion/Unix/Command/_lzop @@ -69,8 +69,9 @@ case "$state" in "F $sep Append a \`*' for executable files" "G $sep Inhibit display of group information" "Q $sep Enclose file names in double quotes" ) + # The "Z" on the next line is sentinel to prevent the character class from being empty. disp=( ${disp[@]:#[Z$PREFIX]*} ) - compset -P '[FGQ]*' + compset -P '[FGQ]#' compadd -d disp - ${disp[@]%% *} && ret=0 ;; esac diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount index a43085ac1..e2c3cfdad 100644 --- a/Completion/Unix/Command/_mount +++ b/Completion/Unix/Command/_mount @@ -856,7 +856,7 @@ fsopt) devordir) local dev_tmp mp_tmp mline - if compset -P '*:'; then + if compset -P 1 '*:'; then _wanted exports expl 'exported path' compadd \ ${${(f)"$(path+=( {/usr,}/sbin(N) ) _call_program exports \ showmount -e ${IPREFIX%:} 2>/dev/null)"}[2,-1]%% *} && ret=0 diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index 52559b800..0914264fe 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -56,7 +56,7 @@ _perl_normal() { _perl_m_opt () { compset -P '-' - if compset -P '*='; then + if compset -P 1 '*='; then _message -e module-arguments 'module arguments, comma separated' else _perl_modules -S= -q diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index 0e840032f..d03f3395e 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -50,7 +50,7 @@ case $state in local -a directives suf local code='foreach (ini_get_all() as $k => $v) { echo "$k\n"; }' directives=( $(_call_program directives $words[1] -r ${(q)code} 2>/dev/null) ) - if compset -P '*='; then + if compset -P 1 '*='; then _default && return 0 else compset -S '=*' || suf=( -qS '=' ) diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin index 8f74939fd..685e4e50b 100644 --- a/Completion/Unix/Command/_rlogin +++ b/Completion/Unix/Command/_rlogin @@ -38,9 +38,9 @@ _rlogin () { '*:files:->files' && ret=0 if [[ -n "$state" ]]; then - if compset -P '*:'; then + if compset -P 1 '*:'; then _remote_files -- rsh && ret=0 - elif compset -P '*@'; then + elif compset -P 1 '*@'; then _wanted hosts expl host _rlogin_hosts -S: && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 5ee4fd2ad..84328199a 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -200,7 +200,7 @@ _ssh () { case "$lstate" in option) - if compset -P '*='; then + if compset -P 1 '*='; then case "${IPREFIX#-o}" in (#i)(ciphers|macs|kexalgorithms|hostkeyalgorithms|pubkeyacceptedkeytypes|hostbasedkeytypes)=) if ! compset -P +; then @@ -628,9 +628,9 @@ _ssh () { fi ;; file) - if compset -P '[^./][^/]#:'; then + if compset -P 1 '[^./][^/]#:'; then _remote_files -- ssh ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 - elif compset -P '*@'; then + elif compset -P 1 '*@'; then suf=( -S '' ) compset -S ':*' || suf=( -r: -S: ) _wanted hosts expl 'remote host name' _ssh_hosts $suf && ret=0 @@ -642,9 +642,9 @@ _ssh () { fi ;; rfile) - if compset -P '*:'; then + if compset -P 1 '*:'; then _remote_files -- ssh && ret=0 - elif compset -P '*@'; then + elif compset -P 1 '*@'; then _wanted hosts expl host _ssh_hosts -r: -S: && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail index fbe30f13a..89e9cfbae 100644 --- a/Completion/Unix/Command/_tail +++ b/Completion/Unix/Command/_tail @@ -56,7 +56,7 @@ case $state in sign='signs:sign:((+\:"start at the specified byte/line"' sign+=' -\:"output the last specified bytes/lines (default)"))' digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '*[0-9]'; then + if compset -P '[0-9]##'; then _alternative $mlt $digit && ret=0 elif [[ -z $PREFIX ]]; then _alternative $sign $digit && ret=0 diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index 9569368a5..6e83a6781 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -90,7 +90,7 @@ case "$state" in option) local -a options options=( ${${(M)${(f)"$(_call_program options $words[1] -show-option 2>/dev/null)"}:# -o *}/(#b) -o (*)=[^ ]#[[:blank:]]##(*)/$match[1]:${match[2]:l}} ) - if compset -P '*='; then + if compset -P 1 '*='; then _message -e values 'value' else compset -S '=*' || suf=( -S '=' ) @@ -98,7 +98,7 @@ case "$state" in fi ;; pauth) - if compset -P '*:'; then + if compset -P 1 '*:'; then _message -e passwords 'password' else compset -S ':*' || suf=( -S ':' ) diff --git a/Completion/X/Command/_rdesktop b/Completion/X/Command/_rdesktop index 5e480b333..55a6ea7b5 100644 --- a/Completion/X/Command/_rdesktop +++ b/Completion/X/Command/_rdesktop @@ -89,9 +89,8 @@ case $state in ;; redirection) redir="${PREFIX%%:*}" - if compset -P '*='; then + if compset -P 1 '*='; then curcontext="${curcontext%:*}:$redir" - compset -P '*=' case $redir in comport|lptport) _wanted devices expl device _files -g '*(-%)' && ret=0 ;; disk) _directories && ret=0 ;; diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index ebc6aacbf..13c5572af 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -82,12 +82,16 @@ xev) xhost) local type tmp match + if [[ -z $PREFIX ]]; then + _describe prefixes '(-:disallow +:allow)' -S '' -r '' + fi + if compset -P '-'; then tmp=(${(f)"$(xhost)"}) shift tmp tmp=(${tmp:#LOCAL:|<*>}) if [[ "$tmp" = *:* ]]; then - if compset -P '(#b)(*):'; then + if compset -P 1 '(#b)(*):'; then type="$match[1]" _tags displays while _tags; do @@ -118,7 +122,7 @@ xhost) if [[ "$PREFIX" = *:* ]]; then type="${(L)PREFIX%%:*}" - compset -P '*:' + compset -P 1 '*:' case "$type" in inet) _hosts && ret=0;; diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index 68456cc3d..b90436a01 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -68,7 +68,7 @@ esac if [[ -n $state ]]; then zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- - if [[ -z ${line:#*=*} ]] && compset -P '*='; then + if [[ -z ${line:#*=*} ]] && compset -P 1 '*='; then _message -e replacements 'replacement' elif [[ -prefix [0-9] ]]; then events=( ${(0)"$(printf "%-${#HISTNO}.${#HISTNO}s $sep %s\0" "${(kv)history[@]}")"} ) diff --git a/Completion/Zsh/Type/_arrays b/Completion/Zsh/Type/_arrays index 24c8957e8..c28fb179e 100644 --- a/Completion/Zsh/Type/_arrays +++ b/Completion/Zsh/Type/_arrays @@ -2,4 +2,4 @@ local expl -_wanted arrays expl array _parameters "$@" - -g '*array*' +_wanted arrays expl array _parameters "$@" -g '*array*' diff --git a/Completion/Zsh/Type/_globflags b/Completion/Zsh/Type/_globflags index 5833dc8f1..13ef14c17 100644 --- a/Completion/Zsh/Type/_globflags +++ b/Completion/Zsh/Type/_globflags @@ -1,5 +1,8 @@ #autoload +# Complete 'globbing flags', i.e., '(#x)'; everything up to the '#' will +# have been "compset -P"'d by the caller. + local ret=1 local -a flags diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234 index 8edf0d0cb..0671cebb2 100644 --- a/Completion/Zsh/Type/_ps1234 +++ b/Completion/Zsh/Type/_ps1234 @@ -58,11 +58,14 @@ if compset -P '%[FK]'; then fi if compset -P '%[0-9-\\]#(\\|)\([0-9-]#[^0-9]'; then + # ternary conditional: first delimiter compset -S '*' _delimiters && ret=0 elif compset -P '%[0-9-\\]#[<>\]]'; then + # truncation _message -e replacements 'replacement string' elif compset -P '%[0-9-\\]#(\\|)\([0-9-]#'; then + # ternary conditional: condition character compset -S '[.:+/-%]*' || suf=( -S . ) compset -S '*' specs=( diff --git a/Completion/Zsh/Type/_vars b/Completion/Zsh/Type/_vars index 0f97d6cda..ec59c03be 100644 --- a/Completion/Zsh/Type/_vars +++ b/Completion/Zsh/Type/_vars @@ -1,7 +1,7 @@ #compdef getopts unset # This will handle completion of keys of associative arrays, e.g. at -# `vared foo['. +# `vared foo[' could complete to `vared foo[key]'. local ret=1 -- cgit v1.2.3 From dd8b7566106fb4f571988b3cbc8cae26107629a3 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 18 Oct 2016 02:31:36 +0000 Subject: _git-cherry-pick: Complete argv[2] et seq. --- Completion/Unix/Command/_git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 437036a9b..f10f80bf7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -530,7 +530,7 @@ _git-cherry-pick () { '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ - ': : __git_commit_ranges -O expl:git_commit_opts' + '*: : __git_commit_ranges -O expl:git_commit_opts' } (( $+functions[_git-citool] )) || -- cgit v1.2.3 From d90775fc29425934895b0222aa4092f12e9bcd1c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 3 Nov 2016 16:00:45 +0100 Subject: 39822: _git: remove "-A '-*'" with _arguments for some commands With e.g. `git rebase origin/master` you can have options like `--no-autosquash` after the argument. I have tried the commands where this patch removes `-A`. Commands like `git fetch-pack` that do not support options after arguments are left unchanged. --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 3ed655135..63c80e04d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-11-03 Daniel Hahler + * 39822: Completion/Unix/Command/_git: remove "-A '-*'" with + _arguments for some commands. + 2016-11-03 Peter Stephenson * 39815: Src/lex.c, Test/D04parameter.ztst: read input to end diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f10f80bf7..17a7b1e07 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1383,7 +1383,7 @@ _git-rebase () { '(--autosquash )--no-autosquash[do not check for auto-squash boundaries]') fi - _arguments -A '-*' \ + _arguments \ - actions \ '(-)--continue[continue after resolving merge conflict]' \ '(-)--abort[abort current rebase]' \ @@ -1921,7 +1921,7 @@ _git-tag () { ) fi - _arguments -A '-*' \ + _arguments \ - creation \ '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create a signed and annotated tag]' \ @@ -4539,7 +4539,7 @@ _git-pack-objects () { fi # NOTE: --index-version is only used by the Git test suite. - _arguments -A '-*' \ + _arguments \ '(-q --quiet)'{-q,--quiet}"[don't report progress]" \ '(-q --quiet --all-progress)--progress[show progress meter]' \ '(-q --quiet --progress --all-progress-implied)--all-progress[show progress meter during object writing phase]' \ @@ -4876,7 +4876,7 @@ _git-ls-files () { (( $+functions[_git-ls-remote] )) || _git-ls-remote () { # TODO: repository needs fixing - _arguments -A '-*' \ + _arguments \ '(-q --quiet)'{-q,--quiet}"[don't print remote URL]" \ '--upload-pack=[specify path to git-upload-pack on remote side]:remote path' \ '(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \ @@ -5007,7 +5007,7 @@ _git-show-ref () { (( $+functions[_git-unpack-file] )) || _git-unpack-file () { - _arguments -A '-*' \ + _arguments \ '(:)-h[display usage information]' \ '(-): :__git_blobs' } -- cgit v1.2.3 From d7b57cc9576648020f4f68b52cce5c7e59548258 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 12 Nov 2016 01:01:28 +0000 Subject: 39922: __git_recent_branches: Fix an 'assertion' failure when two branches (refs) point to the same commit. --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 19 ++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index fa12468e9..65974fc9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-11-17 Daniel Shahaf + * 39922: Completion/Unix/Command/_git: __git_recent_branches: + Fix an 'assertion' failure when two branches (refs) point to + the same commit. + * 39917: Completion/Zsh/Command/_precommand: Complete setsid(1) as a precommand diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 17a7b1e07..94457fce2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6076,7 +6076,8 @@ __git_recent_branches__names() (( $+functions[__git_recent_branches] )) || __git_recent_branches() { - local -a branches descriptions + local -a branches + local -A descriptions local -a reply local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/ refs/tags/')"}"#refs/(heads|tags)/} ) @@ -6093,19 +6094,15 @@ __git_recent_branches() { fi # 4. Obtain log messages for all of them in one shot. - descriptions=( ${(f)"$(_call_program all-descriptions git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branches} --)"} ) - - if (( $#branches != $#descriptions )); then - # ### Trouble... - zle -M "__git_recent_branches: \$#branches != \$#descriptions" - return 1 - fi + # TODO: we'd really like --sort=none here... but git doesn't support such a thing. + # The \n removal is because for-each-ref prints a \n after each entry. + descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} refs/tags/${(q)^branches} "--")"//$'\n'} ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions - local branch description - for branch description in ${branches:^descriptions} ; do - branches_colon_descriptions+="${branch//:/\:}:${description}" + local branch + for branch in ${branches} ; do + branches_colon_descriptions+="${branch//:/\:}:${(v)descriptions[(I)(refs/heads/|refs/tags/)${(b)branch}]}" done _describe -V -t recent-branches "recent branches" branches_colon_descriptions -- cgit v1.2.3 From 297471cf7737c4dfe8097988b8a5bd61872df837 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 12 Nov 2016 01:01:29 +0000 Subject: 39921: __git_recent_branches: Remove erroneous parsing of partial ref names as tags. In the reflog, partial ref names in the "from" field always represent names of heads. (That is not true for the "to" field.) The parsing of tag names was added in commit 39102 (317c96b64f43688a6be08a8b1c93b6ab4eed662c) for equivalence with the then-previous implementation which used `git log $partial_ref_name`. The equivalence was correct, however, the then-previous implementation was not, since it would consider $partial_ref_name as a refs/tags/ name if a refs/heads/ name did not exist. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 65974fc9a..aa3b57bf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-11-17 Daniel Shahaf + * 39921: Completion/Unix/Command/_git: __git_recent_branches: + Remove erroneous parsing of partial ref names as tags. + * 39922: Completion/Unix/Command/_git: __git_recent_branches: Fix an 'assertion' failure when two branches (refs) point to the same commit. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 94457fce2..4dba93bb2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6079,7 +6079,7 @@ __git_recent_branches() { local -a branches local -A descriptions local -a reply - local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/ refs/tags/')"}"#refs/(heads|tags)/} ) + local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/')"}"#refs/heads/} ) # 1. Obtain names of recently-checked-out branches from the reflog. # 2. Remove ref names that that no longer exist from the list. @@ -6096,13 +6096,13 @@ __git_recent_branches() { # 4. Obtain log messages for all of them in one shot. # TODO: we'd really like --sort=none here... but git doesn't support such a thing. # The \n removal is because for-each-ref prints a \n after each entry. - descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} refs/tags/${(q)^branches} "--")"//$'\n'} ) + descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} "--")"//$'\n'} ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions local branch for branch in ${branches} ; do - branches_colon_descriptions+="${branch//:/\:}:${(v)descriptions[(I)(refs/heads/|refs/tags/)${(b)branch}]}" + branches_colon_descriptions+="${branch//:/\:}:${descriptions[refs/heads/${(b)branch}]}" done _describe -V -t recent-branches "recent branches" branches_colon_descriptions -- cgit v1.2.3 From df8d219da3e660a5721f25615f2d6d55c96690dc Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 11 Nov 2016 09:59:14 +0000 Subject: 39916 + 39930 + tweak: _git: Complete options and values for -c. The "$@" in the option-names call is added in order to propagate the new (-S =) arguments. This bifurcates _git-config() in order to provide completion for % git -c % git -c foo= --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 50 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index f3dbffcc0..9415eefae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-11-18 Daniel Shahaf + + * 39916 + 39930 + tweak: Completion/Unix/Command/_git: Complete + options and values for -c. + 2016-11-17 Peter Stephenson * 39958: Src/Zle/compctl.c, Src/builtin.c, Src/compat.c, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4dba93bb2..8fdca2898 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2031,7 +2031,7 @@ _tig () { (( $+functions[_git-config] )) || _git-config () { local name_arg value_arg - local curcontext=$curcontext state line expl ret=1 + local curcontext=$curcontext state line ret=1 declare -A opt_args if (( words[(I)--get-regexp] )); then @@ -2087,6 +2087,38 @@ _git-config () { '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 + __git_config_option-or-value "$@" && ret=0 + return ret +} + +(( $+functions[__git_config_option] )) || +__git_config_option () { + local -A opt_args=() + local -a line=( ${words[CURRENT]%%=*} ) + local state=option + __git_config_option-or-value "$@" +} + +(( $+functions[__git_config_value] )) || +__git_config_value () { + local -A opt_args=() + local -a line=( ${words[CURRENT]%%=*} ${words[CURRENT]#*=} ) + local state=value + __git_config_option-or-value "$@" +} + +# Helper to _git-config(). May be called by other functions, too, provided +# that The caller has set $line, $state, and $opt_args as _git-config() would +# set them: +# +# - set $line[1] to the option name being completed (even if completing an +# option value). +# - set $opt_args to git-config(1) options, as set by _arguments in +# _git-config(). +# - set $state as _arguments in _git-config() would set it. +(( $+functions[__git_config_option-or-value] )) || +__git_config_option-or-value () { + local expl ret # TODO: Add support for merge.*. (merge driver), diff.*. (diff driver), and filter.*. (filter driver) options # (see gitattributes(5)). @@ -2843,7 +2875,7 @@ _git-config () { _describe -t option-names $label \ sections -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' -S . -- \ sections_and_options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' -qS . -- \ - options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' && ret=0 + options -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' "$@" && ret=0 ;; (gettable-option) _wanted git-options expl option compadd -M 'r:|.=* r:|=*' -a - git_present_options && ret=0 @@ -7459,7 +7491,7 @@ _git() { '(- :)--version[display version information]' \ '(- :)--help[display help message]' \ '-C[run as if git was started in given path]: :_directories' \ - '*-c[pass configuration parameter to command]:parameter' \ + '*-c[pass configuration parameter to command]: :->configuration' \ '--exec-path=-[path containing core git-programs]:: :_directories' \ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ '(: -)--info-path[print the path where the info files are installed and exit]' \ @@ -7490,6 +7522,18 @@ _git() { fi fi ;; + (configuration) + if compset -P 1 '*='; then + __git_config_value && ret=0 + else + if compset -S '=*'; then + __git_config_option && ret=0 # don't move cursor if we completed just the "foo." in "foo.bar.baz=value" + compstate[to_end]='' + else + __git_config_option -S '=' && ret=0 + fi + fi + ;; esac else _call_function ret _$service -- cgit v1.2.3 From a74294edbeb1c0cf9b48e6414559f57ad76dc017 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 24 Nov 2016 07:17:33 +0000 Subject: unposted: _git-config: Fix user.email completion to complete only bare email addresses. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 1c0d3673c..be0570778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-11-29 Daniel Shahaf + + * unposted: Completion/Unix/Command/_git: _git-config: Fix + user.email completion to complete only bare email addresses. + 2016-11-28 Daniel Shahaf * 40011: Completion/Base/Core/_main_complete, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8fdca2898..283c50cc0 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2613,7 +2613,7 @@ __git_config_option-or-value () { uploadarchive.allowUnreachable:'allow git-upload-archive to accept an archive requests that ask for unreachable objects::->bool:false' 'url.*.insteadOf:string to start URLs with:prefix:->string' 'url.*.pushInsteadOf:string to start URLs to push to with:prefix:->string' - user.email:'email address used for commits::_email_addresses' + user.email:'email address used for commits::_email_addresses -c' user.name:'full name used for commits:name:->string' user.signingkey:'default GPG key to use when creating signed tags::__git_gpg_secret_keys' web.browser:'web browser to use::__git_browsers') -- cgit v1.2.3 From 110ffae9fefa1367af4fdcc90a456de23b92436c Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 28 Nov 2016 22:53:24 -0800 Subject: 40035: Cosmetic fixes for comments and documentation. Mostly fixes to doubled words. --- ChangeLog | 7 +++++-- Completion/Base/Utility/_arguments | 2 +- Completion/Unix/Command/_git | 2 +- Completion/Unix/Type/_zfs_dataset | 2 +- Completion/Zsh/Command/_zstyle | 2 +- Completion/Zsh/Function/_zargs | 2 +- Doc/Zsh/builtins.yo | 2 +- Doc/Zsh/compsys.yo | 4 ++-- Doc/Zsh/contrib.yo | 2 +- Etc/ChangeLog-4.3 | 2 +- Src/Zle/zle_refresh.c | 2 +- Src/glob.c | 2 +- Src/hist.c | 2 +- Src/input.c | 2 +- Src/subst.c | 2 +- Src/zsh.h | 2 +- Util/helpfiles | 2 +- 17 files changed, 22 insertions(+), 19 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index a016ce0e6..0d5f61198 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-11-29 Peter Stephenson + * 40035: Eitan Adler: Cosmetic fixes mostly for duplication in + comments and documentation. + * 40026: Src/Zle/zle_tricky.c: More care with redirection completion. Fixes for completion after > in "!> ." that should add to sanity. @@ -3523,7 +3526,7 @@ 2015-09-28 Barton E. Schaefer - * 36669: Src/lex.c: fix ${(z)...} of an an incomplete math + * 36669: Src/lex.c: fix ${(z)...} of an incomplete math expression by restoring "((" at the front of the token 2015-09-28 Daniel Shahaf @@ -9517,7 +9520,7 @@ 2013-07-20 Peter Stephenson * 31545: Src/exec.c, Src/parse.c: if FD_CLOEXEC is available, - so mark dump file file descriptors, avoiding possible + so mark dump file descriptors, avoiding possible multiple use of file descriptors. 2013-07-19 Peter Stephenson diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 82c969629..d2c0d33de 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -105,7 +105,7 @@ if (( long )); then continue else # Still no comment, add the previous options anyway. - # Add a ':' after the option anyways, to make the the matching of + # Add a ':' after the option anyways, to make the matching of # the options lateron work as intended. # It will be removed again later. lopts+=("${^tmp[@]}":) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 283c50cc0..da049bd23 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6114,7 +6114,7 @@ __git_recent_branches() { local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/')"}"#refs/heads/} ) # 1. Obtain names of recently-checked-out branches from the reflog. - # 2. Remove ref names that that no longer exist from the list. + # 2. Remove ref names that no longer exist from the list. # (We must do this because #3 would otherwise croak on them.) __git_recent_branches__names; branches=( ${(@)reply:*valid_ref_names_munged} ) diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset index 6c625e9ec..6bef04e45 100644 --- a/Completion/Unix/Type/_zfs_dataset +++ b/Completion/Unix/Type/_zfs_dataset @@ -4,7 +4,7 @@ local -a type expl_type_arr rsrc rdst paths_allowed local -a typearg datasetlist expl mlist local expl_type -# -e takes an argument which is passed as as the "descr" argument to _wanted +# -e takes an argument which is passed as the "descr" argument to _wanted # -p indicates that filesystem paths, not just dataset names, are allowed # -r1 indicates that we're completing the source of a rename # -r2 indicates that we're completing the destination of a rename diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index d6f285271..0e828225e 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -266,7 +266,7 @@ while (( $#state )); do _wanted contexts expl "$state_descr" compadd -a patterns ;; - # 'metapatterns': patterns that are are matched not against contexts, but + # 'metapatterns': patterns that are matched not against contexts, but # against patterns. (metapatterns) zstyle -g patterns diff --git a/Completion/Zsh/Function/_zargs b/Completion/Zsh/Function/_zargs index c24b276f2..f974ab646 100644 --- a/Completion/Zsh/Function/_zargs +++ b/Completion/Zsh/Function/_zargs @@ -4,7 +4,7 @@ local arguments eofstr pos=$((CURRENT)) numeofs=0 ret=1 cmdpos=1 #this doesn't handle '--' on the command line, only -- #it also by extension doesn't handle eofstr being the empty string -#it also also doesn't handle eofstr being -e or --eof, and everything will +#it also doesn't handle eofstr being -e or --eof, and everything will # probably also be confused if the command at the end takes a -e, --eof= or -- eofstr=${${${${words[(r)(--eof=*|-e*)]}#--eof=}#-e}:---} while { diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 169a31ea3..7b04d0648 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -570,7 +570,7 @@ with emulations to be set to their values in tt(sh). tt(fno) then calls tt(fni); because tt(fni) is also marked for sticky tt(sh) emulation, no option changes take place on entry to or exit from it. Hence the option tt(cshnullglob), turned off by tt(sh) emulation, will -be turned on within tt(fni) and remain on on return to tt(fno). On exit +be turned on within tt(fni) and remain on return to tt(fno). On exit from tt(fno), the emulation mode and all options will be restored to the state they were in before entry to the temporary emulation. diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index ceb98c7bc..60ef9ee2c 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -144,8 +144,8 @@ directory mentioned in the tt(fpath) parameter, and should be autoloaded few utility functions, arrange for all the necessary shell functions to be autoloaded, and will then re-define all widgets that do completion to use the new system. If you use the tt(menu-select) widget, which is part of the -tt(zsh/complist) module, you should make sure that that module is loaded -before the call to tt(compinit) so that that widget is also +tt(zsh/complist) module, you should make sure that the module is loaded +before the call to tt(compinit) so that the widget is also re-defined. If completion styles (see below) are set up to perform expansion as well as completion by default, and the TAB key is bound to tt(expand-or-complete), tt(compinit) will rebind it to tt(complete-word); diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 623507283..f764eb7c6 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -3854,7 +3854,7 @@ The expression tt(<) followed (with no space) by a shell identifier causes the value of the variable with that name to be pushed onto the stack. var(ident) may be an integer, in which case the previous result with that number (as shown before -the tt(>) in th standard standard tt(zcalc) prompt) is put on the stack. +the tt(>) in the standard tt(zcalc) prompt) is put on the stack. ) item(Exchange: tt(xy))( The pseudo-function tt(xy) causes the most recent two elements of diff --git a/Etc/ChangeLog-4.3 b/Etc/ChangeLog-4.3 index 1be618b48..6d85e40af 100644 --- a/Etc/ChangeLog-4.3 +++ b/Etc/ChangeLog-4.3 @@ -1182,7 +1182,7 @@ 2011-08-16 Wayne Davison - * 29650: Src/jobs.c: don't lose the the time info after a + * 29650: Src/jobs.c: don't lose the time info after a suspend+restore. 2011-08-15 Peter Stephenson diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index e78f1e562..8d173cda1 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -946,7 +946,7 @@ addmultiword(REFRESH_ELEMENT *base, ZLE_STRING_T tptr, int ichars) /* * Swap the old and new video buffers, plus any associated multiword - * buffers. The new buffer becomes the old one; the new new buffer + * buffers. The new buffer becomes the old one; the new buffer * will be filled with the command line next time. */ static void diff --git a/Src/glob.c b/Src/glob.c index 33bf2ae18..623e6f1d6 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -1174,7 +1174,7 @@ checkglobqual(char *str, int sl, int nobareglob, char **sp) } /* Main entry point to the globbing code for filename globbing. * - * np points to a node in the list list which will be expanded * + * np points to a node in the list which will be expanded * * into a series of nodes. */ /**/ diff --git a/Src/hist.c b/Src/hist.c index 5be7d2524..97fd34039 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -1038,7 +1038,7 @@ hbegin(int dohist) /* * pws: We used to test for "|| (inbufflags & INP_ALIAS)" * in this test, but at this point we don't have input - * set up up so this can trigger unnecessarily. + * set up so this can trigger unnecessarily. * I don't see how the test at this point could ever be * useful, since we only get here when we're initialising * the history mechanism, before we've done any input. diff --git a/Src/input.c b/Src/input.c index eb968ea72..fe94b8ef7 100644 --- a/Src/input.c +++ b/Src/input.c @@ -51,7 +51,7 @@ * Note that the input string is itself used as the input buffer: it is not * copied, nor is it every written back to, so using a constant string * should work. Consequently, when passing areas of memory from the heap - * it is necessary that that heap last as long as the operation of reading + * it is necessary that the heap last as long as the operation of reading * the string. After the string is read, the stack should be popped with * inpop(), which effectively flushes any unread input as well as restoring * the previous input state. diff --git a/Src/subst.c b/Src/subst.c index c7c552257..a26ebb1d6 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -2368,7 +2368,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags, * This is the inner handling for the case referred to above * where we have something like ${${(P)name}...}. * - * Treat this as as a normal value here; all transformations on + * Treat this as a normal value here; all transformations on * result are in outer instance. */ aspar = 0; diff --git a/Src/zsh.h b/Src/zsh.h index a5d4455e3..63cada827 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1589,7 +1589,7 @@ struct zpc_disables_save { /* * Bit vector of ZPC_COUNT disabled characters. * We'll live dangerously and assumed ZPC_COUNT is no greater - * than the number of bits an an unsigned int. + * than the number of bits an unsigned int. */ unsigned int disables; }; diff --git a/Util/helpfiles b/Util/helpfiles index 699ca8321..9e837fe2d 100755 --- a/Util/helpfiles +++ b/Util/helpfiles @@ -19,7 +19,7 @@ # This script is called automatically during `make install' # unless specified otherwise. -# For usage and and more information see zshcontrib(1). +# For usage and more information see zshcontrib(1). sub Usage { print(STDERR "Usage: helpfiles zshbuiltins.1 dest-dir [link-file]\n"); -- cgit v1.2.3 From f65283e1ad8e8f2215f3f824a2d48c7bdeb22ec5 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 1 Dec 2016 21:48:20 +0100 Subject: 40055: update git completion for git 2.11.0 --- ChangeLog | 2 ++ Completion/Unix/Command/_git | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) (limited to 'Completion/Unix/Command/_git') diff --git a/ChangeLog b/ChangeLog index 18c5a973b..470331715 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-12-01 Oliver Kiddle + * 40055: Completion/Unix/Command/_git: update for git 2.11.0 + * 40053: Completion/Base/Completer/_external_pwds: exclude current directory of active zsh from completion matches diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index da049bd23..b5b3e79eb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -610,6 +610,7 @@ _git-clone () { '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \ '(-j --jobs)'{-j+,--jobs=}'[specify number of submodules cloned in parallel]:jobs' \ '--reference[reference repository]:repository:_directories' \ + '--reference-if-able[reference repository]:repository:_directories' \ '--dissociate[make the newly-created repository independent of the --reference repository]' \ '(-q --quiet)'{-q,--quiet}'[operate quietly]' \ '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \ @@ -623,6 +624,8 @@ _git-clone () { '--template=[directory to use as a template for the object database]: :_directories' \ '*'{-c,--config}'[= set a configuration variable in the newly created repository]' \ '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \ + '--shallow-since=[shallow clone since a specific time]:time' \ + '*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \ '(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \ '(--single-branch)--no-single-branch[clone history leading up to each branch]' \ '--shallow-submodules[any cloned submodules will be shallow]' \ @@ -845,6 +848,9 @@ _git-fetch () { _arguments -C -S -s \ $fetch_options \ + '--shallow-since=[deepen history of shallow repository based on time]:time' \ + '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ + '--deepen[deepen history of shallow clone]:number of commits' \ '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ '*:: :->repository-or-group-or-refspec' && ret=0 @@ -885,7 +891,7 @@ _git-format-patch () { '(-n --numbered -N --no-numbered -k --keep-subject)'{-N,--no-numbered}'[name output in \[PATCH\] format]' \ '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \ '--numbered-files[use only number for file name]' \ - '(-n --numbered -N --no-numbered -k --keep-subject --subject-prefix)'{-k,--keep-subject}'[do not strip/add \[PATCH\] from the first line of the commit message]' \ + '(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ '(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \ '( --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \ @@ -897,7 +903,8 @@ _git-format-patch () { '--in-reply-to=[make the first mail a reply to the given message]:message id' \ '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \ '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the -th iteration of the topic]: :__git_guard_number iteration' \ - '(-k --keep-subject)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ + '(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \ + '(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ '*--to=[add To: header to email headers]: :_email_addresses' \ '*--cc=[add Cc: header to email headers]: :_email_addresses' \ '--from=[add From: header to email headers]: :_email_addresses' \ @@ -1688,7 +1695,7 @@ _git-status () { _arguments -S -s \ '(-s --short --column --no-column)'{-s,--short}'[output in short format]' \ $branch_opts \ - '(-s --short)--porcelain[produce machine-readable output]' \ + '(-s --short)--porcelain=-[produce machine-readable output]:version:(v1)' \ '(-u --untracked-files)'{-u-,--untracked-files=-}'[show untracked files]::mode:((no\:"show no untracked files" \ normal\:"show untracked files and directories" \ all\:"also show untracked files in untracked directories (default)"))' \ @@ -3352,6 +3359,7 @@ _git-mergetool () { '--tool-help[print a list of merge tools that may be used with "--tool"]' \ '(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of merge resolution program]' \ '(-y --no-prompt)--prompt[prompt before invocation of merge resolution program]' \ + '-O-[process files in the order specified in file]:order file:_files' \ '*:conflicted file:_files' } @@ -3652,6 +3660,8 @@ _git-blame () { '(-n --show-number)'{-n,--show-number}'[show the line number in the original commit]' \ '-s[suppress author name and timestamp]' \ '-w[ignore whitespace when finding lines]' \ + '--indent-heuristic[use indent-based heuristic to improve diffs]' \ + '--compaction-heuristic[use blank-line-based heuristic to improve diffs]' \ $revision_options \ ':: :__git_revisions' \ ': :__git_cached_files' && ret=0 @@ -4752,18 +4762,23 @@ _git-write-tree () { (( $+functions[_git-cat-file] )) || _git-cat-file () { _arguments -S -s \ - '(- 1)-t[show type of given object]' \ - '(- 1)-s[show size of given object]' \ - '(- 1)-e[exit with zero status if object exists]' \ - '(- 1)-p[pretty-print given object]' \ - '(- 1)--textconv[show content as transformed by a textconv filter]' \ - '--allow-unknown-type[allow -s and -t to work with broken/corrupt objects]' \ - '(- :)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \ - '(- :)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \ + '(-t -s -e -p --allow-unknown-type 1)--textconv[show content as transformed by a textconv filter]' \ + '(-t -s -e -p --allow-unknown-type 1)--filters[show content as transformed by filters]' \ + '(-t -s -e -p --allow-unknown-type 1)--path=[use a specific path for --textconv/--filters]:path:_directories' \ + - query \ + '(-s -e -p --textconv --filters 1)-t[show type of given object]' \ + '(-t -e -p --textconv --filters 1)-s[show size of given object]' \ + '(-e -p --textconv --filters 1)--allow-unknown-type[allow query of broken/corrupt objects of unknown type]' \ + '(-t -s -p -textconv --filters --allow-unknown-type 1)-e[exit with zero status if object exists]' \ + '(-t -s -e -textconv --filters --allow-unknown-type 1)-p[pretty-print given object]' \ + '(-):object type:(blob commit tag tree)' \ + ': :__git_objects' \ + - batch \ + '(--batch-check)--batch=-[print SHA1, type, size and contents (or in specified format)]::format' \ + '(--batch)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \ '--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \ '--batch-all-objects[show all objects with --batch or --batch-check]' \ - '(-):object type:(blob commit tag tree)' \ - ': :__git_objects' + '--buffer[disable flushing of output after each object]' } (( $+functions[_git-diff-files] )) || @@ -4900,6 +4915,7 @@ _git-ls-files () { '(-s --stage -u --unmerged)--with-tree=[treat paths removed since given tree-ish as still present]: :__git_tree_ishs' \ '-v[identify each files status (hmrck?)]' \ '--full-name[force paths to be output relative to the project top directory]' \ + '--recurse-submodules[recurse through submodules]' \ '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ '--debug[show debugging data]' \ '*:: :_files' -- cgit v1.2.3