From dd33472831756895a86153c651c18580a6dccbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 13 Aug 2019 14:26:50 +0200 Subject: completion: complete values of configuration variables after 'git -c var=' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'git config' expects a configuration variable's name and value in separate options, so we complete values as they stand on their own on the command line. 'git -c', however, expects them in a single option joined by a '=' character, so we should be able to complete values when they are following 'section.name=' in the same word. Add new options to the __git_complete_config_variable_value() function to allow callers to specify the current word to be completed and the configuration variable whose value is to be completed, and use these to complete possible values after 'git -c 'section.name='. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- t/t9902-completion.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index bf60a11fa8..9e90a64830 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1733,6 +1733,13 @@ test_expect_success 'git -c - variable name' ' EOF ' +test_expect_success 'git -c - value' ' + test_completion "git -c color.pager=" <<-\EOF + false Z + true Z + EOF +' + test_expect_success 'sourcing the completion script clears cached commands' ' __git_compute_all_commands && verbose test -n "$__git_all_commands" && -- cgit v1.2.3