completion: add space after config variable names also in Bash 3
commit30bd55f901c97c310e674c051f00920f38a66ee0
authorPhilippe Blain <levraiphilippeblain@gmail.com>
Sat, 10 Feb 2024 18:32:20 +0000 (10 18:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Feb 2024 17:43:41 +0000 (12 09:43 -0800)
tree799fc4490d66b4d9cd36807969fdeb44f8285a64
parentb50a608ba20348cb3dfc16a696816d51780e3f0f
completion: add space after config variable names also in Bash 3

In be6444d1ca (completion: bash: add correct suffix in variables,
2021-08-16), __git_complete_config_variable_name was changed to use
"${sfx- }" instead of "$sfx" as the fourth argument of _gitcomp_nl and
_gitcomp_nl_append, such that this argument evaluates to a space if sfx
is unset. This was to ensure that e.g.

git config branch.autoSetupMe[TAB]

correctly completes to 'branch.autoSetupMerge ' with the trailing space.
This commits notes that the fix only works in Bash 4 because in Bash 3
the 'local sfx' construct at the beginning of
__git_complete_config_variable_name creates an empty string.

Make the fix also work for Bash 3 by using the "unset or null' parameter
expansion syntax ("${sfx:- }"), such that the parameter is also expanded
to a space if it is set but null, as is the behaviour of 'local sfx' in
Bash 3.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash