Re: [PATCH] config: skip continued lines when matching section
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 20, 2026, 00:44 UTC
- Message-ID
- <xmqqbj7ktjp7.fsf@gitster.g>
- In-Reply-To
- <20261119192307.2683812-1-dmnk@google.com>
Dominik Maier <dmnk@google.com> writes:
> When a value in the target section spans multiple lines via a trailing > backslash and a continuation line begins with '[other]', removing or > renaming the section stops early at '[other]' and leaves the remainder > of the continued value behind as an unquoted '[other]' section.
If the behaviour was to treat these as continued values from day one, I would have agreed that it would be a reasonably design, but offhand I do not know if this is a breaking change in behaviour that may negatively affect existing configuration files.
Show 15 quoted lines
> @@ -3434,7 +3525,7 @@ static int repo_config_copy_or_rename_section_in_file(
> const char *old_name,
> const char *new_name, int copy)
> {
> - int ret = 0, remove = 0;
> + int ret = 0, remove = 0, continued = 0, in_quote = 0;
> char *filename_buf = NULL;
> struct lock_file lock = LOCK_INIT;
> int out_fd;
> @@ -3496,9 +3587,12 @@ static int repo_config_copy_or_rename_section_in_file(
> goto out;
> }
>
> + int was_continued = continued;
> +This triggers -Wdeclaration-after-statement doesn't it?
(administrivia)
I do not consider myself an area expert for the configuration file editing code. Please do not directly Cc: random people unless you know they are specifically familiar with the area or they are positively interested in the topic and they will regret if they miss your message if they fail to notice.
Thanks.