Re: [PATCH] revision: introduce --exclude=<glob> to tame wildcards
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 31, 2013, 00:29 UTC
- Message-ID
- <xmqqwqn2wvlz.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CACsJy8DOx8Q5kLizfeP2AgDaD8+EDsQL9xtOGphrmgG=dAabcQ@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 15 quoted lines
> On Sat, Aug 31, 2013 at 6:55 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> +static int ref_excluded(struct rev_info *revs, const char *path)
>> +{
>> + struct string_list_item *item;
>> +
>> + if (!revs->ref_excludes)
>> + return 0;
>> + for_each_string_list_item(item, revs->ref_excludes) {
>> + if (!fnmatch(item->string, path, 0))
>> + return 1;
>> + }
>> + return 0;
>> +}
>
> If you pursue this, please use wildmatch instead so it supports "foo/**".The thought crossed my mind and I think we should match what the existing --glob=<pattern> option does. A cursory look in refs.c::filter_refs() used by refs.c::for_each_glob_ref_in() tells me that we are using fnmatch without FNM_PATHNAME, so that is what the above part does.