summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar SZEDER Gábor <szeder.dev@gmail.com>2019-08-13 14:26:50 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-08-13 12:31:04 -0700
commitdd33472831756895a86153c651c18580a6dccbc8 (patch)
tree03efbb35cd3556f8d2272343b977176e2b18c034 /t
parentcompletion: complete configuration sections and variable names for 'git -c' (diff)
downloadtgif-dd33472831756895a86153c651c18580a6dccbc8.tar.xz
completion: complete values of configuration variables after 'git -c var='
'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=<TAB>'. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t9902-completion.sh7
1 files changed, 7 insertions, 0 deletions
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" &&