mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
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>
This commit is contained in:
parent
32f54ca317
commit
c84de70781
6
dir.c
6
dir.c
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue