diff options
author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-06-26 18:06:42 +0000 |
---|---|---|
committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-06-28 13:01:09 +0000 |
commit | a4b4a3a7c7d9c94c1b19cab285f0a333761a3416 (patch) | |
tree | d80233f962a9b70dfac76844f6b377d2e6260321 | |
parent | 17764224381663132657ded58bbded7579a60b39 (diff) | |
download | zsh-a4b4a3a7c7d9c94c1b19cab285f0a333761a3416.tar.gz zsh-a4b4a3a7c7d9c94c1b19cab285f0a333761a3416.tar.xz zsh-a4b4a3a7c7d9c94c1b19cab285f0a333761a3416.zip |
46131: _git-config: Partly fix a bug whereby a 'foo.ba<TAB>' wouldn't be completed to 'foo.bar.baz'.
Now it properly gets completed, but in the case of gpg.openpgp.program, the description would be shown as "unknown option name", that being the description of gpg.*.program via `git help -c`, which shadows the more description of gpg.openpgp.program in $git_options.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index c5773aaa7..1da0d92bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2020-06-28 Daniel Shahaf <d.s@daniel.shahaf.name> + * 46131: Completion/Unix/Command/_git: _git-config: Partly + fix a bug whereby a 'foo.ba<TAB>' wouldn't be completed to + 'foo.bar.baz'. + * 46128: Completion/Unix/Command/_git: Complete more options and diff/merge tools. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1a8f28651..05e2a2361 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2963,6 +2963,7 @@ __git_config_option-or-value () { pretty remotes ${(u)${(M)${git_options%%:*}:#*[.][*][.]*}%%.*} + ${(u)${(M)git_present_options:#*[.][*][.]*}%%.*} ) local key for key in $git_present_options ; do @@ -3008,6 +3009,7 @@ __git_config_option-or-value () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend + # TODO: completing 'gpg.openpgp<TAB>' adds both 'gpg.openpgp.program' and 'gpg.*.program' to $options, so it ends up being listed as 'unknown option name' even though we have a description # When completing 'remote.foo.<TAB>', 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.<TAB>', offer 'bar' if $git_options contains 'remote.*.bar'. @@ -3045,8 +3047,7 @@ __git_config_option-or-value () { elif compset -P '[^.]##.'; then local opt declare -a match mbegin mend - # TODO: completing 'gpg.openpgp<TAB>' doesn't offer 'gpg.openpgp.program' - for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do + 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)${IPREFIX}${opt%%:*}.*]} )); then sections_and_options+=$opt else |