summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar SZEDER Gábor <szeder.dev@gmail.com>2019-08-13 14:26:52 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-08-13 12:31:05 -0700
commit5af9d5f6c8530f873ab6a1fce6071c703be2e8d6 (patch)
tree2b4dff14dc6b3b1eb274d019554894562b8ef192 /t
parentcompletion: complete config variables names and values for 'git clone -c' (diff)
downloadtgif-5af9d5f6c8530f873ab6a1fce6071c703be2e8d6.tar.xz
completion: complete config variables and values for 'git clone --config='
Completing configuration sections and variable names for the stuck argument of 'git clone --config=<TAB>' requires a bit of extra care compared to doing the same for the unstuck argument of 'git clone --config <TAB>', because we have to deal with that '--config=' being part of the current word to be completed. Add an option to the __git_complete_config_variable_name_and_value() and in turn to the __git_complete_config_variable_name() helper functions to specify the current section/variable name to be completed, so they can be used even when completing the stuck argument of '--config='. __git_complete_config_variable_value() already has such an option, and thus no further changes were necessary to complete possible values after 'git clone --config=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.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 9e90a64830..5d98d66dbd 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1740,6 +1740,27 @@ test_expect_success 'git -c - value' '
EOF
'
+test_expect_success 'git clone --config= - section' '
+ test_completion "git clone --config=br" <<-\EOF
+ branch.Z
+ browser.Z
+ EOF
+'
+
+test_expect_success 'git clone --config= - variable name' '
+ test_completion "git clone --config=log.d" <<-\EOF
+ log.date=Z
+ log.decorate=Z
+ EOF
+'
+
+test_expect_success 'git clone --config= - value' '
+ test_completion "git clone --config=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" &&