Git development
 help / color / mirror / Atom feed
From: Dominik Maier <dmnk@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Dominik Maier <dmnk@google.com>,
	git@vger.kernel.org,  Phillip Wood <phillip.wood@dunelm.org.uk>,
	Chris Torek <chris.torek@gmail.com>,
	 dmnk+artist@google.com
Subject: Re: [PATCH v2] config: skip continued lines when matching section
Date: Mon, 30 Nov 2026 17:22:08 +0100	[thread overview]
Message-ID: <20261130162208.3367274-1-dmnk@google.com> (raw)
In-Reply-To: <xmqqtsl3op3h.fsf@gitster.g>

On Thu, Nov 26, 2026 at 02:37:38AM -0800, Junio C Hamano wrote:
> We return when at the end of line, or not at '['.  Otherwise we go to
> the next loop.  Wait...why check eol?  '\r' or '\n' are certainly not
> '[' so wouldn't it be the same as "if (end <= p || *p != '[')"?  Wnat am
> I missing?

Nothing missed, "if (end <= p || *p != '[')" is strictly simpler since
'*p != '['' already rejects '\r' and '\n'.

> The proposed commit log message does not make it clear why we want to
> reject an empty "[]".  Or what should happen to say "[ ]" for that
> matter.

In git_parse_source(), "[]" returns 0 from get_base_var() with an empty
strbuf and then stops at "var->len < 1", while "[ ]" enters
get_extended_base_var(), skips whitespace, sees ']' instead of '"', and
returns -1. Because git_parse_source() aborts on both rather than
treating the rest of the line as a key=value that could continue onto
the next line, skip_section_header() rejects both as well.

Sending v3 simplifying that guard, spelling out "[]" and "[ ]" in the
commit message, adding a "[ ]" test case, and rebasing cleanly onto
current master.

Best
Dominik

  parent reply	other threads:[~2026-11-30 16:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 19:23 [PATCH] config: skip continued lines when matching section Dominik Maier
2026-11-20  0:44 ` Junio C Hamano
2026-11-20 14:33   ` Phillip Wood
2026-11-24 18:05 ` [PATCH v2] " Dominik Maier
2026-11-26 10:37   ` Junio C Hamano
2026-11-26 11:00     ` Chris Torek
2026-11-30 16:22     ` Dominik Maier [this message]
2026-11-30 16:22     ` [PATCH v3] " Dominik Maier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130162208.3367274-1-dmnk@google.com \
    --to=dmnk@google.com \
    --cc=chris.torek@gmail.com \
    --cc=dmnk+artist@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox