diff options
-rw-r--r-- | config.c | 10 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 5 |
2 files changed, 9 insertions, 6 deletions
@@ -62,7 +62,8 @@ static char *parse_value(void) if (comment) continue; if (isspace(c) && !quote) { - space = 1; + if (len) + space++; continue; } if (!quote) { @@ -71,11 +72,8 @@ static char *parse_value(void) continue; } } - if (space) { - if (len) - value[len++] = ' '; - space = 0; - } + for (; space; space--) + value[len++] = ' '; if (c == '\\') { c = get_next_char(); switch (c) { diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 43ea283242..91cbd551d8 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -733,6 +733,11 @@ echo >>result test_expect_success '--null --get-regexp' 'cmp result expect' +test_expect_success 'inner whitespace kept verbatim' ' + git config section.val "foo bar" && + test "z$(git config section.val)" = "zfoo bar" +' + test_expect_success SYMLINKS 'symlinked configuration' ' ln -s notyet myconfig && |