From: Jacob Keller Date: Thu, 15 May 2025 16:27:45 GMT Subject: Re: [PATCH RFC] diff --no-index: teach option to exclude files by pattern Message-ID: In-Reply-To: On Wed, May 14, 2025 at 2:10 PM Junio C Hamano wrote: > > Jacob Keller writes: > > > From: Jacob Keller > > > > Teach git diff --no-index the ability to exclude files by wildmatch > > pattern when recursing through directories. The '--exclude' option > > builds up a string list containing the patterns. These are checked with > > wildmatch() in the read_directory_contents function. If any pattern > > matches, then the file is not included in the directory contents. > > A quite natural question that comes to mind is: > > How would we do this for the normal "git diff" that is not the > bolted on '--no-index' mode? > > but ... > > > The --exclude option is only supported by the --no-index mode. Standard > > diff modes support negative pathspecs which is more powerful. I tried to > > see if there was a way to add support for negative pathspecs themselves, > > but haven't yet figured out if this is possible. > > ... of course you have thought about it already. I do agree with > you that we should figure out how and teach this mode to also use > pathspec, not necessarily only the negative ones but positive ones. > Sure, though I think we might need either an option or some other way to distinguish pathspec vs the existing non-pathspec mode. > After all, > > $ git diff --no-index [