completion: bash: add correct suffix in variables
__gitcomp automatically adds a suffix, but __gitcomp_nl and others don't, we need to specify a space by default. Can be tested with: git config branch.autoSetupMe<tab> This fix only works for versions of bash greater than 4.0, before that "local sfx" creates an empty string, therefore the unset expansion doesn't work. The same happens in zsh. Therefore we don't add the test for that for now. The correct fix for all shells requires semantic changes in __gitcomp, but that can be done later. Cc: SZEDER Gábor <szeder.dev@gmail.com> Tested-by: David Aguilar <davvid@gmail.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Aug 16, 2021 at 04:10 UTC
be6444d1ca96fdd702b383de860e243aa7e65619
1 file changed
+3
-3
contrib/completion/git-completion.bash
+3
-3
@@ -2652,7 +2652,7 @@ __git_complete_config_variable_name ()
2652
local pfx="${cur_%.*}."
2653
cur_="${cur_#*.}"
2654
__gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
2655
- __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "$sfx"
2655
+ __gitcomp_nl_append $'autoSetupMerge\nautoSetupRebase\n' "$pfx" "$cur_" "${sfx- }"
2656
return
2657
;;
2658
guitool.*.*)
@@ -2686,7 +2686,7 @@ __git_complete_config_variable_name ()
2686
local pfx="${cur_%.*}."
2687
cur_="${cur_#*.}"
2688
__git_compute_all_commands
2689
- __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx"
2689
+ __gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx- }"
2690
return
2691
;;
2692
remote.*.*)
@@ -2702,7 +2702,7 @@ __git_complete_config_variable_name ()
2702
local pfx="${cur_%.*}."
2703
cur_="${cur_#*.}"
2704
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
2705
- __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx"
2705
+ __gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "${sfx- }"
2706
return
2707
;;
2708
url.*.*)