virtualfilesystem: check if directory is included

Add check to see if a directory is included in the virtualfilesystem
before checking the directory hashmap.  This allows a directory entry
like foo/ to find all untracked files in subdirectories.
This commit is contained in:
Kevin Willford 2018-10-09 10:19:14 -06:00 коммит произвёл Johannes Schindelin
Родитель 0dcea80534
Коммит 36f84e957b
2 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -222,6 +222,8 @@ test_expect_success 'verify folder entries include all files' '
cat > expected <<-\EOF && cat > expected <<-\EOF &&
?? dir1/a ?? dir1/a
?? dir1/b ?? dir1/b
?? dir1/dir2/a
?? dir1/dir2/b
?? dir1/untracked.txt ?? dir1/untracked.txt
EOF EOF
test_cmp expected actual test_cmp expected actual

Просмотреть файл

@ -232,6 +232,10 @@ int is_excluded_from_virtualfilesystem(const char *pathname, int pathlen, int dt
} }
if (dtype == DT_DIR) { if (dtype == DT_DIR) {
int ret = is_included_in_virtualfilesystem(pathname, pathlen);
if (ret > 0)
return 0;
if (!parent_directory_hashmap.tablesize && virtual_filesystem_data.len) if (!parent_directory_hashmap.tablesize && virtual_filesystem_data.len)
initialize_parent_directory_hashmap(&parent_directory_hashmap, &virtual_filesystem_data); initialize_parent_directory_hashmap(&parent_directory_hashmap, &virtual_filesystem_data);
if (!parent_directory_hashmap.tablesize) if (!parent_directory_hashmap.tablesize)