Re: [PATCH 0/6] Introduce pathspec struct
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:39
Nguyen Thai Ngoc Duy [off-list ref] writes:
quoted
$ git log --exclude "Doc*" master..pu -- '*.txt' $ git grep --exclude "t/" -e 'test .*-L' -- '*.sh'I was writing "but you would lose the ability to mix negative and positive pathspecs together, something like 'exclude Documentation except Documentation/technical'",...
I think that is way overengineered. We _could_ make the expressions arbitrarily complex and hard to use by using irregular syntax tricks, but let's not go there. Let's just keep things simple and usable instead. * Without pathspec, everything is included; * pathspecs will filter everything that do not match; * --exclude also filters what matches them from the remainder. So...
$ git log --exclude Documentation --exclude "!Documentation/technical" master..pu -- '*.txt' does not sound too twisted to understand (I hope).
...I would not vote for this.
... If David needs "git grep --exclude-dir" now, he should keep working on builtin/grep.c as he's doing now (maybe change --exclude-dir to --exclude).
That's not what I am saying. Because --exclude-dir is a special case of --exclude, it would be an efficient solution _if_ we can externally keep the command line option compatible with GNU grep as a syntax sugar, and turn it into something else internally that can be passed to your "pathspec with negative" engine.
..., but his work on the command line interface _and tests_ won't be wasted.
Yup.