Subject: Re: git-add ignores exclude markers for ignored files

From: Junio C Hamano <[email-masked]>
Date: Tue, 04 Nov 2025 16:54:00 -0800

Junio C Hamano <[email-masked]> writes:

> This may be an ancient regression when e1b8c7bd (dir: remove struct
> path_simplify, 2017-01-04) was rewritten exclude_matches_pathspec()
> function, which was written in 29209cbe (dir: fix COLLECT_IGNORED on
> excluded prefixes, 2010-03-11), back in the days before ":(exclude)"
> and other pathspec magic was even invented.
>
> Perhaps try this patch?
>
> I have no idea what the ramifications of the change is, though.
> There may be unintended fallouts in some distant corner, even though
> it does not seem to break any existing tests.

One thing that I am extremely uncomfortable about this change is
that I do not quite see why we use this function to begin with.
Given a <path, pathlen>, it seems if the pathspec matches, but why
aren't we using dir.c:match_pathspec() for and have our own separate
and much simple-minded variant instead?