Re: [PATCHv2 1/4] refs: add common refname_match_patterns()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 11, 2012, 23:43 UTC
- Message-ID
- <7vzkcpkkbd.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20120211193742.GD4903@tgrennan-laptop>
Tom Grennan <tmgrennan@gmail.com> writes:
> Yes, I should have stated that this emphasized containment over > efficiency. If instead we stipulate that the caller must list exclusion > patterns before others, this could simply be:
No.
You have to pre-parse and rearrange the pattern[] list *only once* before matching them against dozens of refs, so instead of forcing the callers do anything funky, you give a function that gets a pattern[] list and returns something that can be efficiently used by the match_pattern() function, and have the caller pass that thing, not the original pattern[] list, to the match_pattern() function.
That is how pathspec matching side of the logic is arranged.
I keep saying that it is probably not a good idea to directly reuse the pathspec code, but you would want to study and learn from the overall structure of it.