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

[PATCH v5 1/4] completion: bash: fix prefix detection in branch.*

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jul 7, 2021, 02:31 UTC
Message-ID
<20210707023146.3132162-2-felipe.contreras@gmail.com>
In-Reply-To
<20210707023146.3132162-1-felipe.contreras@gmail.com>
Otherwise we are completely ignoring the --cur argument.
The issue can be tested with:
  git clone --config=branch.<tab>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b50c5d0ea3..47b48fbab6 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2649,8 +2649,8 @@ __git_complete_config_variable_name ()
 		return
 		;;
 	branch.*)
-		local pfx="${cur%.*}."
-		cur_="${cur#*.}"
+		local pfx="${cur_%.*}."
+		cur_="${cur_#*.}"
 		__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
 		__gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
 		return
-- 
2.32.0.36.g70aac2b1aa
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 5 in “completion: bash: a bunch of fixes”
  1. 0/4 completion: bash: a bunch of fixesFelipe Contreras, Jul 7, 2021
  2. 1/4 completion: bash: fix prefix detection in branch.*Felipe Contreras, Jul 7, 2021
  3. 2/4 completion: bash: fix for suboptions with valueFelipe Contreras, Jul 7, 2021
  4. 3/4 completion: bash: fix for multiple dash commandsFelipe Contreras, Jul 7, 2021
  5. 4/4 completion: bash: add correct suffix in variablesFelipe Contreras, Jul 7, 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.