From 5af9d5f6c8530f873ab6a1fce6071c703be2e8d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 13 Aug 2019 14:26:52 +0200 Subject: [PATCH] completion: complete config variables and values for 'git clone --config=' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Completing configuration sections and variable names for the stuck argument of 'git clone --config=' requires a bit of extra care compared to doing the same for the unstuck argument of 'git clone --config ', 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='. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 66 +++++++++++++++++++------- t/t9902-completion.sh | 21 ++++++++ 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 279f04df87..ce7ff0a96d 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1406,6 +1406,11 @@ _git_clone () ;; esac case "$cur" in + --config=*) + __git_complete_config_variable_name_and_value \ + --cur="${cur##--config=}" + return + ;; --*) __gitcomp_builtin clone return @@ -2352,35 +2357,41 @@ __git_complete_config_variable_value () # Completes configuration sections, subsections, variable names. # # Usage: __git_complete_config_variable_name [