Skip to content

Commit

Permalink
excluded_1(): support exclude files in index
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Aug 24, 2009
1 parent 32f54ca commit c84de70
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ static int excluded_1(const char *pathname,
int to_exclude = x->to_exclude;

if (x->flags & EXC_FLAG_MUSTBEDIR) {
if (!dtype) {
if (!prefixcmp(pathname, exclude))
return to_exclude;
else
continue;
}
if (*dtype == DT_UNKNOWN)
*dtype = get_dtype(NULL, pathname, pathlen);
if (*dtype != DT_DIR)
Expand Down

0 comments on commit c84de70

Please sign in to comment.