Skip to content

Commit c84de70

Browse files
pcloudsgitster
authored andcommitted
excluded_1(): support exclude files in index
Index does not really have "directories", attempts to match "foo/" against index will fail unless someone tries to reconstruct directories from a list of file. Observing that dtype in this function can never be NULL (otherwise it would segfault), dtype NULL will be used to say "hey.. you are matching against index" and behave properly. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32f54ca commit c84de70

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dir.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ static int excluded_1(const char *pathname,
349349
int to_exclude = x->to_exclude;
350350

351351
if (x->flags & EXC_FLAG_MUSTBEDIR) {
352+
if (!dtype) {
353+
if (!prefixcmp(pathname, exclude))
354+
return to_exclude;
355+
else
356+
continue;
357+
}
352358
if (*dtype == DT_UNKNOWN)
353359
*dtype = get_dtype(NULL, pathname, pathlen);
354360
if (*dtype != DT_DIR)

0 commit comments

Comments
 (0)