zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 4/4] _git-config: Partly fix a bug whereby a 'foo.ba<TAB>' wouldn't be completed to 'foo.bar.baz'.
Date: Fri, 26 Jun 2020 18:06:42 +0000	[thread overview]
Message-ID: <20200626180642.11809-4-danielsh@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20200626180642.11809-1-danielsh@tarpaulin.shahaf.local2>

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.
---
 Completion/Unix/Command/_git | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 77d3f9059..7a8d03d0b 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

      parent reply	other threads:[~2020-06-26 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26 18:06 [PATCH 1/4] _git-config: Complete some more options Daniel Shahaf
2020-06-26 18:06 ` [PATCH 2/4] _git-config: Fix a bug where a second trailing dot would be incorrectly offered Daniel Shahaf
2020-06-26 18:06 ` [PATCH 3/4] _git: Complete more options and diff/merge tools Daniel Shahaf
2020-06-26 18:06 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200626180642.11809-4-danielsh@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).