From: Junio C Hamano Date: Wed, 04 Feb 2026 20:47:48 GMT Subject: Re: [PATCH] fix git add :!x exiting with error when x is in .gitignore Message-ID: In-Reply-To: <24VdqZCRHE7M9q7Rp-IH60MmQrEOW5lzhtd1-SUNqEhV_OTzGiCUkVDL5ngVJbyWRMDZ2GlWCJ9wkMSJLsJh8QYO4gRhDMGyzhfuGAODOs8=@protonmail.com> "Remy D. Farley" writes: > This case is actually already handled by the pathspec itself. > > > From pathspec.c: >> void parse_pathspec(struct pathspec *pathspec, >> unsigned magic_mask, unsigned flags, >> const char *prefix, const char **argv) >> { >> [...] >> /* >> * If everything is an exclude pattern, add one positive pattern >> * that matches everything. We allocated an extra one for this. >> */ >> if (nr_exclude == n) { >> int plen = (!(flags & PATHSPEC_PREFER_CWD)) ? 0 : prefixlen; >> init_pathspec_item(item + n, 0, prefix, plen, "."); >> pathspec->nr++; >> } Yes, that is from Linus 9 years ago plus a bit of my work, in 859b7f1d (pathspec: don't error out on all-exclusionary pathspec patterns, 2017-02-07) and b02fdbc8 (pathspec: correct an empty string used as a pathspec element, 2022-05-29). No wonder it sounded familiar ;-). Thanks.