On Wed, Mar 21 2018, Dakota Hawkins wrote: > Re-reading the section you quoted again a couple of times you're > correct, but somehow that wasn't clear to me despite reading/searching > for what I wanted to see several times. FWIW I just knew this because I'd run into this the other day, so it was fresh in my mind. > While what I wrote may need improvement, I think there are a couple of > valid concerns with the way this behavior is documented currently: > > - Generally: Reading about pattern matching for .gitignore is > awkward on its face, since positive matches have negative consequences > (in other words `include = !match`). > - Specifically: This behavior that is specific to `foo/` matches is > documented in the section for `!foo` matches. If you're trying to find > the implications of `foo/` you may not have read about `!foo` as > carefully. > > Since this behavior is practically applicable to both pattern formats, > and since patterns in the sum of a repo's .gitignore files can get > somewhat complicated, I think it would be a good idea to either: I think it makes more sense to document it where it's documented now, i.e. under how "!" works in general, since this is an edge case with negative matching. Whether you specify "foo" or "foo/" is then just an unrelated edge case in how we match directories v.s. files, but doesn't per-se have anything to do with how the inversion rules work, so I think it makes sense to document it where we document the inversion rules. I.e. you'd get the same for all of (assuming a directory "foo"): f* !*.txt foo !*.txt foo/ !*.txt So what we subsequently exclude just because it's deeper in the tree has nothing to do with how the disambiguation syntax for matching the directory looks like. > - Do this and basically explain the same behavior twice in two > pattern format sections, or > - Pull the documentation for this behavior out into another section > where users would be likely to find and understand it if they're > looking into either pattern format I think it can certainly be made clearer, but maybe with a practical example (per above) where we also show the dir structure that would/wouldn't be matched. I just chimed in on this one because your patch says the docs are "unclear" then "Explain this behavior (and its implications) more explicitly" without a reference to the existing adjacent docs. I think whatever we do we should be unifying these docs if they're amended, not stating this twice.