Re: [PATCHv2 1/4] refs: add common refname_match_patterns()
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:03
Tom Grennan [off-list ref] 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.