{"thread":{"id":"19976","subject":"[PATCH] completion: __git_config_get_set_variables() handle values with spaces","startedAt":"2009-06-30T05:08:38Z","lastAt":"2009-07-02T06:04:07Z","messageCount":2,"participants":["Stephen Boyd"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"117205","messageId":"1246338518-9030-1-git-send-email-bebarino@gmail.com","threadId":"19976","inReplyTo":null,"subject":"[PATCH] completion: __git_config_get_set_variables() handle values with spaces","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-06-30T05:08:38Z","receivedAt":"2009-06-30T05:08:38Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Commit 0065236 (bash completion: complete variable names for \"git\nconfig\" with options 2009-05-08) implemented its config variable search\nwrong. When a config contains a value with a space and a period (.) in\nit, completion erroneously thinks that line in the configuration is\nmultiple config variables.\n\nFor example\n\n $ cat .git/config\n   format.cc = Junio C Hamano <gitster@pobox.com>\n\n $ git config --unset <TAB>\n   format.cc\n   <gitster@pobox.com>\n\nInstead of using a for loop splitting across spaces, pipe each line to a\nwhile read loop and beef up the case statement to match only\n'config.variable=value'.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n contrib/completion/git-completion.bash |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b60cb68..d676f9d 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1357,11 +1357,12 @@ __git_config_get_set_variables ()\n \t\tc=$((--c))\n \tdone\n \n-\tfor i in $(git --git-dir=\"$(__gitdir)\" config $config_file --list \\\n-\t\t\t2>/dev/null); do\n-\t\tcase \"$i\" in\n-\t\t*.*)\n-\t\t\techo \"${i/=*/}\"\n+\tgit --git-dir=\"$(__gitdir)\" config $config_file --list 2>/dev/null |\n+\twhile read line\n+\tdo\n+\t\tcase \"$line\" in\n+\t\t*.*=*)\n+\t\t\techo \"${line/=*/}\"\n \t\t\t;;\n \t\tesac\n \tdone\n-- \n1.6.3.3.353.g4f2b1\n"},{"id":"117341","messageId":"4A4C4DD7.7030801@gmail.com","threadId":"19976","inReplyTo":"1246338518-9030-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH] completion: __git_config_get_set_variables() handle values with spaces","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-07-02T06:04:07Z","receivedAt":"2009-07-02T06:04:07Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Stephen Boyd wrote:\n> For example\n>\n>  $ cat .git/config\n>    format.cc = Junio C Hamano <gitster@pobox.com>\n>   \n\nSorry this is inaccurate. Something more like\n$ cat .git/config\n[format]\n        cc = Junio C Hamano <gitster@pobox.com>\n\nwould be correct, but I think you got the point.\n"}]}