From: SZEDER Gábor Date: Thu, 28 May 2015 12:29:35 GMT Subject: [PATCH v2 2/2] completion: use new 'git config' options to reliably list variable names Message-ID: <1432816175-18988-3-git-send-email-szeder@ira.uka.de> In-Reply-To: <1432816175-18988-1-git-send-email-szeder@ira.uka.de> List all set config variable names with 'git config --list-names' instead of '--list' and post processing. Similarly, use 'git config --get-name-regexp' instead of '--get-regexp' to get config variables in a given section. Signed-off-by: SZEDER Gábor --- contrib/completion/git-completion.bash | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6abbd564b6..121aa31342 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -744,9 +744,8 @@ __git_compute_porcelain_commands () __git_get_config_variables () { local section="$1" i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "^$section\..*" 2>/dev/null); do - i="${i#$section.}" - echo "${i/ */}" + for i in $(git --git-dir="$(__gitdir)" config --get-name-regexp "^$section\..*" 2>/dev/null); do + echo "${i#$section.}" done } @@ -1774,15 +1773,7 @@ __git_config_get_set_variables () c=$((--c)) done - git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | - while read -r line - do - case "$line" in - *.*=*) - echo "${line/=*/}" - ;; - esac - done + git --git-dir="$(__gitdir)" config $config_file --list-names 2>/dev/null } _git_config () -- 2.4.2.349.g6883b65