conserve
conserve copied to clipboard
`ls --exclude` doesn't exclude the contents of excluded subdirectories
For example:
ls ARCHIVE --exclude /.bundle |less
still prints filenames inside the /.bundle directory.
The cause is: traversal in a stored tree does not need to specifically descend into directories to visit their children, and the children do not necessarily match the exclusion path.
There is a workaround: change the globs so that they do match the children, e.g. /.bundle/**.
The same bug probably affects diff and restore.
There are a couple of possibilities:
- Remember directories that have been excluded, and skip their children later. If there are ever a lot of them (which might be unlikely) this would be a bit inefficient though.
- When building globsets rewrite every glob (not ending in
/**) to also match children of a directory with that name.