{"thread":{"id":"20288","subject":"remote url format in config","startedAt":"2009-07-30T00:52:19Z","lastAt":"2009-07-30T11:41:57Z","messageCount":2,"participants":["John te Bokkel / Tempus","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"119138","messageId":"47ade73f0907291752k62c66903lc2617a16ec0973bd@mail.gmail.com","threadId":"20288","inReplyTo":"47ade73f0907291750v281f3858qd3658c459dd950e8@mail.gmail.com","subject":"remote url format in config","fromName":"John te Bokkel / Tempus","fromEmail":"tanj.tanj@gmail.com","sentAt":"2009-07-30T00:52:19Z","receivedAt":"2009-07-30T00:52:19Z","isPatch":false,"sender":{"key":"tanj.tanj@gmail.com","avatar":null},"body":"There is a bug in the way the url is stored for remote urls. It is\nreally a minor problem and easily worked around. However it may a good\nidea for the future to url encode that string.\n\nWhat happened:\n\nadded a remote with two consecutive spaces in the url.\n\ngit remote add local_remote /dir/folder with\\ \\ -\\ \\ two consecutive\\\n\\ spaces/project.git\n\ngit push local_remote master\n\nerror: url with only single spaces is not a git repo\n\nthe .git/config url is written correctly however it gets munged when\nit is read from the config.\n\n url = /dir/folder with  -  two consecutive  spaces/project.git\n\nto make it work correctly, just quote it.\n\n url = \"/dir/folder with  -  two consecutive  spaces/project.git\"\n\nperhaps it would be a good idea to url encode the url when it is first\nwritten to the config file.\n\n url = /dir/folder%20with%20%20-%20%20two%20consecutive%20%20spaces/project.git\n"},{"id":"119167","messageId":"20090730114157.GA5560@atjola.homenet","threadId":"20288","inReplyTo":"47ade73f0907291752k62c66903lc2617a16ec0973bd@mail.gmail.com","subject":"[PATCH] config: Keep inner whitespace verbatim","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-07-30T11:41:57Z","receivedAt":"2009-07-30T11:41:57Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"Configuration values are expected to be quoted when they have leading or\ntrailing whitespace, but inner whitespace should be kept verbatim even if\nthe value is not quoted. This is already documented in git-config(1), but\nthe code caused inner whitespace to be collapsed to a single space,\nbreaking, for example, clones from a path that has two consecutive spaces\nin it, as future fetches would only see a single space.\n\nReported-by: John te Bokkel <tanj.tanj@gmail.com>\nSigned-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n---\n config.c               |    6 +++---\n t/t1300-repo-config.sh |    5 +++++\n 2 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 738b244..e25b7d6 100644\n--- a/config.c\n+++ b/config.c\n@@ -62,7 +62,8 @@ static char *parse_value(void)\n \t\tif (comment)\n \t\t\tcontinue;\n \t\tif (isspace(c) && !quote) {\n-\t\t\tspace = 1;\n+\t\t\tif (len)\n+\t\t\t\tspace++;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!quote) {\n@@ -72,9 +73,8 @@ static char *parse_value(void)\n \t\t\t}\n \t\t}\n \t\tif (space) {\n-\t\t\tif (len)\n+\t\t\tfor (; space; --space)\n \t\t\t\tvalue[len++] = ' ';\n-\t\t\tspace = 0;\n \t\t}\n \t\tif (c == '\\\\') {\n \t\t\tc = get_next_char();\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 8c43dcd..83b7294 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -755,6 +755,11 @@ echo >>result\n \n test_expect_success '--null --get-regexp' 'cmp result expect'\n \n+test_expect_success 'inner whitespace kept verbatim' '\n+\tgit config section.val \"foo \t  bar\" &&\n+\ttest \"z$(git config section.val)\" = \"zfoo \t  bar\"\n+'\n+\n test_expect_success SYMLINKS 'symlinked configuration' '\n \n \tln -s notyet myconfig &&\n-- \n1.6.3.GIT\n"}]}