Re: [PATCH 2/5] pathspec: add tree_recursive_diff parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes:

> 2010/9/28 Junio C Hamano <gitster@xxxxxxxxx>:
>> Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes:
>> ...
>>>  - If it's recursive diff, directories are just an intermediate step.
>>>    All path must end with a file name. Thus, directories will be
>>>    unconditionally matched.
>>
>> Hmm, I am not sure what you mean by this.  If the pathspec says a/b*/c,
>> you are in "a" and are deciding if you should descend to its subdirectory,
>> then you would surely want to be able to say:
>>
>>  (1) Ah, the subdirectory I am looking at is "bar" and it does match "b*".
>>      It might contain "c"; I should descend into it.
>>
>>  (2) Nope, the subdirectory I am looking at is "frotz" and it can never
>>      match "b*", so there is no point recursing into it.
>
> I did not go that far, trying to analyse the pattern. When I wrote
> "immediate step" I was thinking of "*foo" pattern, which effectively
> means descending to any reachable directories because '*' matches
> slashes too. I think that's the worst case.
>
> Anyway I did not know that I could borrow some optimizations from
> pathspec_matches() in builtin/grep.c.

As you noticed, over time we have polished our re-implementations of the
pathspec logic to avoid needlessly descending into subdirectories, and the
one in the grep may be the latest incarnation of it.  The logic that uses
the path_simplify structure in dir.c may also offer you some inspirations.

Note that the worst case will fall out as a natural consequence of doing
the fallback in the dumb and simple way, so you do not have to worry too
much about it ;-)  I would prefer to see the new, consolidated logic to at
least know the easy optimizations we already have.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]