Skip to content

Commit

Permalink
virtualfilesystem: check if directory is included
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Kevin Willford authored and vdye committed Jul 19, 2023
1 parent 6e313e0 commit ebe9464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/t1093-virtualfilesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ test_expect_success 'verify folder entries include all files' '
cat > expected <<-\EOF &&
?? dir1/a
?? dir1/b
?? dir1/dir2/a
?? dir1/dir2/b
?? dir1/untracked.txt
EOF
test_cmp expected actual
Expand Down
4 changes: 4 additions & 0 deletions virtualfilesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ int is_excluded_from_virtualfilesystem(const char *pathname, int pathlen, int dt
}

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)
initialize_parent_directory_hashmap(&parent_directory_hashmap, &virtual_filesystem_data);
if (!parent_directory_hashmap.tablesize)
Expand Down

0 comments on commit ebe9464

Please sign in to comment.