git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] completion: avoid config variable name lookup error in nounset mode

From
Ville Skyttä <ville.skytta@iki.fi>
Date
Aug 11, 2021, 19:16 UTC
Message-ID
<20210811191637.775693-1-ville.skytta@iki.fi>

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=""
 
 	while test $# != 0; do
 		case "$1" in
-- 
2.25.1
Next: Junio C Hamano
Message 1 of 3 in “completion: avoid config variable name lookup error in nounset mode”
  1. completion: avoid config variable name lookup error in nounset modeVille Skyttä, Aug 11, 2021
  2. Junio C HamanoAug 11, 2021
  3. Felipe ContrerasAug 11, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.