Cache - excluding files or folders with ! not working #713
Description
Describe the bug
Excluding a file or folder does not work as expected with caching. For example,
~/cache
!~/cache/subfolder
is matching:
../../../cache
I think this is because caching uses implicitDescendants: false
. Since we're not traversing any descendants, the negation pattern does not match anything.
One option is to just set implicitDescendants: true
, but this may add inefficiencies as we will need to enumerate all the files and generate a large "includes file" for tar
. We essentially need it to scan the descendants but stop whenever the entire folder is included. For example, the following files:
~/cache/foo.txt
~/cache/bar.txt
~/cache/src/main.c
~/cache/src/lib/baz.dll
~/cache/bin/main.exe
with the glob patterns of ~/cache
and !~/cache/bin
should produce the list:
~/cache/foo.txt
~/cache/bar.txt
~/cache/src
To Reproduce
See https://github.com/dhadka/cache-test-exclusion
Expected behavior
Negated files / folders are excluded from the cache.