As far as I can tell, target directory only contains things that can be easily re-generated using
cargo build or
cargo doc. Also, target far outweigs the source code even in an almost-empty crate. Thus it's a good candidate for exclusion from backups.
I currently achieve this by passing an exclusion regex to my backup program, but that's suboptimal: someday I'll create a directory called "target" and won't notice that it's not being backed up. In my opinion, a much better solution would be for Cargo to automatically mark its target directories with a CACHEDIR.TAG. I can then do
borg create --exclude-caches …, which will automatically exclude these directories from the backup. (GNU Tar and Restic support that CLI option as well, and I bet your backup solution does, too).
Contribution guidelines on github.com/rust-lang/cargo told me to post here before opening an issue there, so: what do you folk think about this idea? Is this incompatible with something? Would this break anything in your personal workflow? I never worked on Cargo, but I'm pretty confident I can implement this if I have a green light.