Git development
 help / color / mirror / Atom feed
From: Aniket Gupta <aniketgupta3001@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Mike Beaton <mjsbeaton@gmail.com>,
	Matt Hunter <m@lfurio.us>,
	Phillip Wood <phillip.wood123@gmail.com>
Subject: Re: [PATCH] dir: do not turn blank ignore-file lines into patterns
Date: Sat, 28 Nov 2026 12:58:39 +0530	[thread overview]
Message-ID: <20261128072839.75270-1-aniketgupta3001@gmail.com> (raw)
In-Reply-To: <xmqq4id1xx7n.fsf@gitster.g>

> Well, isn't that the definition of an empty line?
>
> Or are you saying that a line with some whitespace characters on it is
> "a blank line" that should not match anything?  It is entirely possible

Yes, the latter. What I mean is a line that is empty once its trailing
spaces are trimmed. trim_trailing_spaces() reduces a line of only spaces
to "". add_pattern() registers that as empty pattern and an empty
pattern matches any path that ends in a slash. A line that is empty to
begin with is skipped already. It was wrong to write "blank" in the log
message.

> justify, as there won't be a way to match a file with a funny name,
> like three spaces, e.g.,

There still is, by quoting the spaces with backslashes. "\ \ \ " in an
ignore file ignores a file named with 3 spaces, with and without the
patch. An unquoted line of 3 spaces never matched it as it is trimmed to
nothing. Nothing is lost.

> "A line that holds just a CR in a file with CRLF line endings" is a
> confusing phrasing.  Do you mean a three-byte line "\r\r\n"?  That is
> hardly an empty line (it has a lone CR on it).  On the other hand, by
> definition, a line with two bytes "\r\n" in a file with CRLF line
> endings is an empty line.  Without making it clear which one you mean,

I meant the two byte "\r\n". By your definition it is an empty line but
add_patterns_from_buffer() tests "entry != buf + i" before it drops the
CR, so the line is not skipped and an empty pattern is added from it.
The three-byte "\r\r\n" is not involved.

I will describe it in these terms in the log message. Apologies if I was
unclear before.

  reply	other threads:[~2026-11-28  7:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 12:49 [BUG] check-ignore matches trailing-slash paths against CRLF blank lines Mike Beaton
2026-11-06 18:29 ` [PATCH] dir: do not turn blank ignore-file lines into patterns Aniket Gupta
2026-11-19 17:19   ` Aniket Gupta
     [not found]     ` <CAHzAAWQo89ox+S_jtPX9DOtzfr-+3uMbWHN+HXdi9Aw2q57+Ng@mail.gmail.com>
2026-11-21  9:45       ` Aniket Gupta
2026-11-27 16:21   ` Aniket Gupta
2026-11-28  5:24   ` Matt Hunter
2026-11-28  7:28     ` Aniket Gupta
2026-11-28 10:47     ` Aniket Gupta
2026-11-29  3:21       ` Junio C Hamano
2026-11-28  6:54   ` Junio C Hamano
2026-11-28  7:28     ` Aniket Gupta [this message]
2026-11-29  4:01       ` Junio C Hamano
2026-11-28  9:38   ` Matt Hunter
2026-11-28 10:12     ` Aniket Gupta
2026-11-29  6:00   ` [PATCH v2] dir: ignore CRLF-empty and space-only lines in pattern files Aniket Gupta
2026-11-29 11:14     ` Matt Hunter
2026-11-29 11:42       ` Aniket Gupta

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=20261128072839.75270-1-aniketgupta3001@gmail.com \
    --to=aniketgupta3001@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=m@lfurio.us \
    --cc=mjsbeaton@gmail.com \
    --cc=phillip.wood123@gmail.com \
    /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