Dominik Maier reported that repo_config_copy_or_rename_section_in_file() scans a config file line by line and treats any line whose first non-whitespace character is '[' as the start of a new section. It does not track values continued across lines with a trailing backslash. If a continuation line begins with '[other]', removing or renaming the section stops at '[other]' and leaves the rest of the value behind as an unquoted '[other]' section.

His patch tracks backslash continuations, including quoted subsections and quote state across continued lines, so '#' or ';' inside quotes are not taken for comments. Only then does it treat '[' as a section start.

Junio Hamano said that because git_parse_source() already treats a trailing backslash on a value line as continuing onto the next line, keeping this function in sync fixes a real corruption bug for remove, rename and copy without changing how config files are read. He also confirmed that the handling of '\r' matches get_next_char() in config.c, and that checking 'p < end' when setting the continued flag avoids a false continuation when a file ends in a backslash with no newline.

Chris Torek added observations from his own attempts to pin down config file behaviour. He said 'git config set' and implicit config updates misbehave when the values in question are found in an included config, and suggested Git could warn or fail when they cannot be updated. He also commented on carriage returns in subsection names.

The patch is at v1; the excerpts show no objections to it.