]> git.ipfire.org Git - thirdparty/git.git/commit
completion: complete configuration sections and variable names for 'git -c'
authorSZEDER Gábor <szeder.dev@gmail.com>
Tue, 13 Aug 2019 12:26:49 +0000 (14:26 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2019 19:31:04 +0000 (12:31 -0700)
commite1e00089da9f616d23f0ca3bb183258e9013c469
treeed1def6fbc51c67133cae7683e10b2eb9ce69c6f
parent42d0efec592ecd6bc8858ffb5d64fb0bbca827d4
completion: complete configuration sections and variable names for 'git -c'

'git config' expects a configuration variable's name and value in
separate arguments, so we let the __gitcomp() helper append a space
character to each variable name by default, like we do for most other
things (--options, refs, paths, etc.).  'git -c', however, expects
them in a single option joined by a '=' character, i.e.
'section.name=value', so we should append a '=' character to each
fully completed variable name, but no space, so the user can continue
typing the value right away.

Add an option to the __git_complete_config_variable_name() function to
allow callers to specify an alternate suffix to add, and use it to
append that '=' character to configuration variables.  Update the
__gitcomp() helper function to not append a trailing space to any
completion words ending with a '=', not just to those option with a
stuck argument.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
t/t9902-completion.sh