> Huh, affected by what? At this point I have no idea what the issue
> even is, the only thing I know is that we have an empty pattern now.
The problem is a line in a pattern file that "looks empty" but isnt. It
is either a 2 byte "\r\n" line in a file with CRLF line endings, or a
line that holds only spaces. Git skips an empty line by default,
however, these 2 lines only become empty after git strips the "\r" and
the trailing spaces, and by then, it passes the empty string to
add_pattern() which records a zero length pattern. A zero length pattern
matches a path argument that ends in a slash because its basename is
empty, so "git check-ignore foo/" says an untracked foo/ is ignored
because of that line. In a cone-mode sparse-checkout file, the same line
makes git print 2 warnings and disable cone matching. In the patch I try
to skip a line which is empty after trimming. Allow me to start the
message this way in v4.
> Okay. With git-check-ignore(1) we can append that slash ourselves, and
> thus it may trigger the bug. And this is in contrast to git-status(1)
> and git-add(1) seemingly, which never have that trailing slash.
True. status and add match a directory before they add the slash.
check-ignore can be given a path argument that ends in one.
> Sorry for repeating all of that, but I'm trying to deciper this AI
> message and am having a hard time doing so.
Claude discovered the problem while I was trying to understand the code
around it. Since I am new to open source and English not being my first
language, I use it to review my code and to correct my messages. I
realize I am only making it more complicated for your understanding.
> Okay. Is this a cosmetic issue, or is it something that results in
> wrong behaviour?
It does not check out wrong files, but it is more than cosmetic. With
one such line in a cone-mode sparse-checkout file, git prints 2 warnings
and disables cone matching. Because of that, the sparse index is
expanded to a full one, and "git sparse-checkout list" shows raw
patterns like "/a/" instead of the directory name "a". I can explain
like this in v4.
> Would it make sense to maybe clarify the rule to say "A blank line or
> a line that consists of spaces, only, matches no files"?
Yeah I think that would help. I will change it in gitignore.adoc in v4.