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 <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 20, 2009 at 20:47 UTC
c84de70781674a35b9bfd20aa5bc8c47582615df
1 file changed
+6
dir.c
+6
@@ -349,6 +349,12 @@ static int excluded_1(const char *pathname,
349
int to_exclude = x->to_exclude;
350
351
if (x->flags & EXC_FLAG_MUSTBEDIR) {
352
+ if (!dtype) {
353
+ if (!prefixcmp(pathname, exclude))
354
+ return to_exclude;
355
+ else
356
+ continue;
357
+ }
358
if (*dtype == DT_UNKNOWN)
359
*dtype = get_dtype(NULL, pathname, pathlen);
360
if (*dtype != DT_DIR)