unison icon indicating copy to clipboard operation
unison copied to clipboard

Support ignoring cache directories following the Cache Directory Tagging Specification (CACHEDIR.TAG)

Open FSMaxB opened this issue 2 years ago • 5 comments

The Cache Directory Tagging Specification is a specification that provides applications the ability to mark their cache directories by putting in a file called CACHEDIR.TAG with the content Signature: 8a477f597d28d172789f06886806bc55. These files can then be recognized by backup or synchronization tools so that they can skip the cache files.

Some Software that creates CACHEDIR.TAG files already:

  • Rusts cargo package manager
  • pytest and mypy
  • fontconfig

Some Archiving/Backup software that have options to exclude cache direcories:

  • GNU tar
  • Borg backup

It would be great if unison had a configuration option to ~~support this~~ automatically ignore cache directories following this specification. Especially with rust target directories being easily in the gigabytes.

FSMaxB avatar Oct 20 '21 20:10 FSMaxB

What do you mean by "support this"? Should unison put such a marker in its own .unison directory where the archives live? Or should it provide an option to automatically ignore directories with that marker?

acolomb avatar Oct 20 '21 21:10 acolomb

Or should it provide an option to automatically ignore directories with that marker.

^ This, an option to support automatically ignoring directories with that marker.

Tagging .unison probably wouldn't be such a good idea because it not only contains the archive files but also the profiles, which are more than just caching.

FSMaxB avatar Oct 20 '21 21:10 FSMaxB

This seems reasonable to me.

The only question is whether it needs to be a preference or if cachedirs should always be ignored. I suspect some people do want them synced, but maybe there are no such people.

gdt avatar Oct 21 '21 12:10 gdt

If unison was starting from a clean slate it would probably be a good idea to make this a default, but as it stands I don't think anybody is expecting that an update suddenly stops synchronizing some directories without asking, so it should probably be opt-in instead of opt-out/unconditional.

What might be worth looking into is automatically adding the option for new profiles but leaving existing profiles as they are.

FSMaxB avatar Oct 21 '21 18:10 FSMaxB

Good point about unexpected changes. I lean to less magic so default-off new option seems good. Happy to have discussion on unison-users about the details when/if a mergeable PR materializes.

gdt avatar Oct 21 '21 19:10 gdt