Re: [PATCHv3 1/5] refs: add match_pattern()
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:07
Tom Grennan [off-list ref] writes:
Yes, I tried to minimize change but the conversion of argv's to string_list's won't add that much.
How about _not_ using string_list? After all, string_list is not just a collection of strings, but is a table to hold strings with attributes. I thought argv_array is more appropriate abstraction for the purpose of your patch.
quoted
ref_match_pattern("refs/heads/master", ["maste?", NULL], ["refs/heads/", NULL], (REF_MATCH_FNM_PATH|REF_MATCH_LEADING)); Note that the above "ref_match_pattern()" gives the same "flags" for the call to match_one() for elements in both positive and negative array and it is very deliberate. See review comment to [3/5] for the reasoning.OK, I think that I understand, but please confirm, you'd expect no output in the above example, right?
"maste?" would match with FNM_PATHNAME with "refs/heads/master" but the negative "refs/heads/" matches with it, so yeah, I expect that the function would return false.