[BUG] Suspected with double asterisk in conditional include pattern
- From
Jason Karns <jason.karns@gmail.com>
- Date
- Mar 14, 2019, 17:30 UTC
- Message-ID
- <CAKNmmv26G05GO7hG9bNvMsjpuUMHZRA+2f94TuG2wDNUwNhHkw@mail.gmail.com>
Hello,
I believe I've encountered a bug regarding the use of double asterisk ( /**/ ) within includeIf patterns.
git-config man pages state that
**/ and /**, that can match multiple path components
They then refer to the gitignore man pages which further define supported wildcard patterns:
A slash followed by two consecutive asterisks then a slash matches
zero or more directories.
For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.My understanding of these docs are that the pattern `/usr/local/**/Homebrew/` ought to match both`/usr/local/cache/Homebrew/foo` and `/usr/local/Homebrew/foo`.
However, given the following conditional include rule:
[includeIf "gitdir:/usr/local/**/Homebrew/"]
The external config file is successfully included while in repo `/usr/local/cache/Homebrew/foo` but NOT `/usr/local/Homebrew/foo`.
If I change the pattern to `**/Homebrew/**`, then the pattern matches both desired repos. So it would seem that the `/**/` does not match 0 directories when the pattern begins with a slash.
Thank you, Jason