Re: [PATCH] dir: skip excluded directory with nested repo on prefix match
On 9/22/26 6:57 AM, Junio C Hamano wrote:
Show 21 quoted lines
> René Scharfe <l.s.r@web.de> writes:
>
>> @@ -2034,8 +2040,13 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
>> strbuf_release(&sb);
>>
>> if (nested_repo) {
>> - if ((dir->flags & DIR_SKIP_NESTED_GIT) ||
>> - (matches_how == MATCHED_RECURSIVELY_LEADING_PATHSPEC))
>> + if (dir->flags & DIR_SKIP_NESTED_GIT)
>> + return path_none;
>> + if (!matches_how)
>> + matches_how = dir_match(istate, pathspec,
>> + dirname, len);
>> + if (!matches_how ||
>> + matches_how == MATCHED_RECURSIVELY_LEADING_PATHSPEC)
>> return path_none;
>
> Here, we do not know if we have pathspec==NULL. Shouldn't "make
> sure we have a result from dir_match() and return path_none as
> appropriate" be done only when pathspec != NULL or something like
> that, since dir_match() will crash if pathspec is NULL?Ugh, nasty, that was silly of me. Thanks for finding this bug!
René