From: Stephen Boyd Date: Tue, 30 Jun 2009 05:08:38 +0000 (-0700) Subject: completion: __git_config_get_set_variables() handle values with spaces X-Git-Tag: v1.6.4-rc0~11 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f581de1b7b9d17c83b188bf8ffe536fb8a9dd2a4;p=git.git completion: __git_config_get_set_variables() handle values with spaces Commit 0065236 (bash completion: complete variable names for "git config" with options 2009-05-08) implemented its config variable search wrong. When a config contains a value with a space and a period (.) in it, completion erroneously thinks that line in the configuration is multiple config variables. For example $ cat .git/config format.cc = Junio C Hamano $ git config --unset format.cc Instead of using a for loop splitting across spaces, pipe each line to a while read loop and beef up the case statement to match only 'config.variable=value'. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1f44ec209..9c488646d 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1357,11 +1357,12 @@ __git_config_get_set_variables () c=$((--c)) done - for i in $(git --git-dir="$(__gitdir)" config $config_file --list \ - 2>/dev/null); do - case "$i" in - *.*) - echo "${i/=*/}" + git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | + while read line + do + case "$line" in + *.*=*) + echo "${line/=*/}" ;; esac done