From: René Scharfe Date: Sat, 26 Sep 2026 10:51:30 GMT Subject: Re: [PATCH] dir: skip excluded directory with nested repo on prefix match Message-ID: <78937658-ac31-4ec9-8f8a-ce8fb74ed196@web.de> In-Reply-To: On 9/22/26 6:57 AM, Junio C Hamano wrote: > René Scharfe 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é