Re: [PATCH 32/36] pathspec: allow querying for attributes
- From
Stefan Beller <sbeller@google.com>
- Date
- Oct 27, 2016, 21:32 UTC
- Message-ID
- <CAGZ79kYTOhWbmk27x3JwwBqPedmw-sKbP9S4FJqcM6yT_uQKiA@mail.gmail.com>
- In-Reply-To
- <CACsJy8DhsaTY1w_e-0O5d4KLxr4Gmo3g9rDagQq1ooSHywcRoQ@mail.gmail.com>
On Wed, Oct 26, 2016 at 6:33 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 14 quoted lines
> (sorry if this should have been answered if I went through the series > patch by patch, I wanted to do a proper review but finally have to > admit to myself I won't, so I just skim through a single giant diff > instead) > > On Sun, Oct 23, 2016 at 6:32 AM, Stefan Beller <sbeller@google.com> wrote: >> +attr;; >> +After `attr:` comes a space separated list of "attribute >> +requirements", all of which must be met in order for the >> +path to be considered a match; > > What about (attr=abc def,attr=ghi lkj)? Does it mean (abc && def) || > (ghi && lkj), or abc && def && ghi && lkj? Or is it forbidden to have > multiple 'attr' attribute in the same pathspec?
Good point. I'll add a test for that.
Remembering the original discussion, multiple attrs are forbidden for now as it is unclear what you want to see as a user.
To model (abc && def) || (ghi && lkj), you would need to give multiple pathspec items as these are naturally ORed:
git ls-files :(attr:abc def) :(attr:ghi lkj) .
(compare "git ls-files Makefile README" which gives 2 files to you, that are named respectively.)
To get "abc && def && ghi && lkj" you go with
git ls-files :(attr:abc def ghi lkj) .
as then all things included into this one attr are ANDed. I hope the documentation is clear for one attr.
Thanks, Stefan