Skip to content

Commit

Permalink
Merge pull request #33 virtualfilesystem - check if directory is incl…
Browse files Browse the repository at this point in the history
…uded

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 dscho committed Dec 2, 2018
2 parents d6d6f5d + 9fcb9af commit 91c7411
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions t/t1092-virtualfilesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,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 @@ -228,6 +228,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 91c7411

Please sign in to comment.