Skip to content

Commit c127664

Browse files
Kevin Willforddscho
Kevin Willford
authored andcommitted
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.
1 parent dafd0c9 commit c127664

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

t/t1093-virtualfilesystem.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ test_expect_success 'verify folder entries include all files' '
222222
cat > expected <<-\EOF &&
223223
?? dir1/a
224224
?? dir1/b
225+
?? dir1/dir2/a
226+
?? dir1/dir2/b
225227
?? dir1/untracked.txt
226228
EOF
227229
test_cmp expected actual

virtualfilesystem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ int is_excluded_from_virtualfilesystem(const char *pathname, int pathlen, int dt
236236
}
237237

238238
if (dtype == DT_DIR) {
239+
int ret = is_included_in_virtualfilesystem(pathname, pathlen);
240+
if (ret > 0)
241+
return 0;
242+
239243
if (!parent_directory_hashmap.tablesize && virtual_filesystem_data.len)
240244
initialize_parent_directory_hashmap(&parent_directory_hashmap, &virtual_filesystem_data);
241245
if (!parent_directory_hashmap.tablesize)

0 commit comments

Comments
 (0)