git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: "Ville Skyttä" <ville.skytta@iki.fi>, git@vger.kernel.org
Subject: RE: [PATCH] completion: avoid config variable name lookup error in nounset mode
Date: Wed, 11 Aug 2021 14:40:41 -0500	[thread overview]
Message-ID: <611427b9cd4f1_19f82088b@natae.notmuch> (raw)
In-Reply-To: <20210811191637.775693-1-ville.skytta@iki.fi>

Ville Skyttä wrote:
> Config variable name lookup accesses the `sfx` variable before it has
> been set, causing an error in "nounset" mode. Initialize to an empty
> string to avoid that.
> 
>     $ git config submodule.<Tab>bash: sfx: unbound variable
> 
> Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
> ---
>  contrib/completion/git-completion.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 4bdd27ddc8..ecc9352755 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2631,7 +2631,7 @@ __git_complete_config_variable_value ()
>  #                 subsections) instead of the default space.
>  __git_complete_config_variable_name ()
>  {
> -	local cur_="$cur" sfx
> +	local cur_="$cur" sfx=""

For what it's worth this would break a fix I've sent several times
already [1].

The proper fix requires changing __gitcomp as well, after that sfx can
simply be " ".

All the patches that fix all these issues have been sent, and if you
want to try them out check git-completion [2].

Cheers.

[1] https://lore.kernel.org/git/20210707023146.3132162-5-felipe.contreras@gmail.com/
[2] https://github.com/felipec/git-completion

-- 
Felipe Contreras

      parent reply	other threads:[~2021-08-11 19:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 19:16 [PATCH] completion: avoid config variable name lookup error in nounset mode Ville Skyttä
2021-08-11 19:35 ` Junio C Hamano
2021-08-11 19:40 ` Felipe Contreras [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=611427b9cd4f1_19f82088b@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ville.skytta@iki.fi \
    /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.
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).