Skip to content

Commit e73a1c1

Browse files
Kevin Willforddscho
Kevin Willford
authored andcommitted
Merge pull request #33 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.
2 parents 9d74ff1 + d6a0189 commit e73a1c1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

t/t1092-virtualfilesystem.sh

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

virtualfilesystem.c

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

230230
if (dtype == DT_DIR) {
231+
int ret = is_included_in_virtualfilesystem(pathname, pathlen);
232+
if (ret > 0)
233+
return 0;
234+
231235
if (!parent_directory_hashmap.tablesize && virtual_filesystem_data.len)
232236
initialize_parent_directory_hashmap(&parent_directory_hashmap, &virtual_filesystem_data);
233237
if (!parent_directory_hashmap.tablesize)

0 commit comments

Comments
 (0)