Re: [HALF A PATCH] Teach the '--exclude' option to 'diff --no-index'
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 20, 2009, 15:03 UTC
- Message-ID
- <alpine.DEB.1.00.0902201555490.6302@intel-tinevez-2-302>
- In-Reply-To
- <20090220145331.GA3515@coredump.intra.peff.net>
Hi,
On Fri, 20 Feb 2009, Jeff King wrote:
Show 10 quoted lines
> On Fri, Feb 20, 2009 at 03:12:28PM +0100, Johannes Schindelin wrote: > > > Michael wrote: > > > > > I can't think offhand of a more portable tool that could replace > > > "diff -r -x" here (suggestions, anyone?). > > > > Maybe something like this? > > Great. Using "git diff" was my first thought, too.
Heh :-)
I have to admit that I had something pretty ugly involving find and grep in mind at first, then something equally appalling using GIT_WORKTREE and GIT_INDEX_FILE.
Show 6 quoted lines
> > Note: before it can be included in git.git, documentation and > > tests have to be added; also, it might be a good idea to extend it > > to the "non-no-index" case (maybe I can beat Peff in the number of > > double negations one day...) > > Maybe a config option "diff.denyNonIndexExclude = false"? *ducks*
How about diffNoIndex.denyNonIndexNonExclude = !true? *swans*
> But more seriously, how would a user expect this to interact with > .gitignore? I know gitignore is about ignoring untracked files, but I > can't help but feel the two have something in common. But maybe not. I'm > sick today and my brain is not working very well.
I think that the -x option with regular (not --no-index) diff would be a little different. .gitignore is for "git add" time, while "git diff" happily ignores .gitignore.
Besides, the -x option only works on the basenames (as I implemented it; no idea if GNU diff works the same way, but from Michael's patch it looks like it does).
BTW I just realized that I forgot to add a die() when !no_index && basename_excludes.
Ciao, Dscho