From 5af9d5f6c8530f873ab6a1fce6071c703be2e8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 13 Aug 2019 14:26:52 +0200 Subject: completion: complete config variables and values for 'git clone --config=' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 279f04d..ce7ff0a 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 [