Skip to content

Commit be6444d

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Tested-by: David Aguilar <[email protected]> Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f3cc916 commit be6444d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ __git_complete_config_variable_name ()
26522652
local pfx="${cur_%.*}."
26532653
cur_="${cur_#*.}"
26542654
__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- }"
26562656
return
26572657
;;
26582658
guitool.*.*)
@@ -2686,7 +2686,7 @@ __git_complete_config_variable_name ()
26862686
local pfx="${cur_%.*}."
26872687
cur_="${cur_#*.}"
26882688
__git_compute_all_commands
2689-
__gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "$sfx"
2689+
__gitcomp_nl "$__git_all_commands" "$pfx" "$cur_" "${sfx- }"
26902690
return
26912691
;;
26922692
remote.*.*)
@@ -2702,7 +2702,7 @@ __git_complete_config_variable_name ()
27022702
local pfx="${cur_%.*}."
27032703
cur_="${cur_#*.}"
27042704
__gitcomp_nl "$(__git_remotes)" "$pfx" "$cur_" "."
2705-
__gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "$sfx"
2705+
__gitcomp_nl_append "pushDefault" "$pfx" "$cur_" "${sfx- }"
27062706
return
27072707
;;
27082708
url.*.*)

0 commit comments

Comments
 (0)