public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Remy D. Farley" <one-d-wide@protonmail.com>
Cc: Tian Yuchen <a3205153416@gmail.com>,  git@vger.kernel.org
Subject: Re: [PATCH] fix git add :!x exiting with error when x is in .gitignore
Date: Wed, 04 Feb 2026 12:47:48 -0800	[thread overview]
Message-ID: <xmqqikccnsln.fsf@gitster.g> (raw)
In-Reply-To: <24VdqZCRHE7M9q7Rp-IH60MmQrEOW5lzhtd1-SUNqEhV_OTzGiCUkVDL5ngVJbyWRMDZ2GlWCJ9wkMSJLsJh8QYO4gRhDMGyzhfuGAODOs8=@protonmail.com> (Remy D. Farley's message of "Wed, 04 Feb 2026 20:11:32 +0000")

"Remy D. Farley" <one-d-wide@protonmail.com> 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.

      reply	other threads:[~2026-02-04 20:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 13:30 [PATCH] fix git add :!x exiting with error when x is in .gitignore Remy D. Farley
2026-02-04 16:48 ` Junio C Hamano
2026-02-04 17:53   ` Tian Yuchen
2026-02-04 18:47     ` Junio C Hamano
2026-02-04 20:11       ` Remy D. Farley
2026-02-04 20:47         ` Junio C Hamano [this message]

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=xmqqikccnsln.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=a3205153416@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=one-d-wide@protonmail.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