Re: [PATCH 15/19] pathspec: add match_pathspec_depth()

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

 



2010/12/14 Junio C Hamano <gitster@xxxxxxxxx>:
> Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes:
>
>> match_pathspec_depth() is similar to match_pathspec() except that it
>> can take depth limit.
>>
>> In long term, match_pathspec() should be removed in favor of this
>> function.
>
> Hmm, this strongly suggests that match_pathspec() should take "const
> struct pathspec *" which already contains the necessary information and
> more, including the depth limit, no?

Good idea. Thanks!

>> +int match_pathspec_depth(const char **pathspec, int max_depth,
>> + Â Â Â Â Â Â Â Â Â Â Âconst char *name, int namelen,
>> + Â Â Â Â Â Â Â Â Â Â Âint prefix, char *seen)
>> +{
>> + Â Â int i, retval = 0;
>> +
>> + Â Â if (!pathspec) {
>> + Â Â Â Â Â Â if (max_depth == -1)
>> + Â Â Â Â Â Â Â Â Â Â return MATCHED_RECURSIVELY;
>> +
>> + Â Â Â Â Â Â if (within_depth(name, namelen, 0, max_depth))
>> + Â Â Â Â Â Â Â Â Â Â return MATCHED_EXACTLY;
>
> Why the difference between _RECURSIVELY and _EXACTLY here? ÂIf you have a
> five-level deep project and give max-depth of 1000, shouldn't you get the
> same result as you run the same command with unlimited depth?

But if max-depth is 5 and the project is 1000-level deep, it should
return _EXACTLY, not _RECURSIVELY, right?
-- 
Duy
--
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]