Add feature to exclude symlinks based on where they point to
Feature Request
I am interested in specific functionality related to symbolic links on Linux.
I do not want to follow symbolic links, I think treating them as opaquely as files is fine, except that I would like to ignore specific symbolic links, basically skip them during sync, if the target path they point to starts with a specific prefix (In my case /nix/store).
Use Case
I am using Unison to sync parts of my user profile across my Linux-based client machines running NixOS.
Whenever you build a software package with Nix, the actual build results are stored in a global path that starts with /nix/store, but a symbolic link to the output is created in the current directory, so that you can find it and it does not get garbage collected.
Those links are in all my git project folders, and in some other places. Since their target paths are garbage collected, with the symbolic links preventing collection, those symbolic links are always valid, except when Unison syncs them.
Alternative Solutions
- I don't know much about this, but my impression is that skipping all symbolic links would not be the right choice for what's usually in a user profile directory.
- Not syncing symbolic links when they would be invalid at the destination host might also work.
Please feel free to open a discussion on unison-users or hackers. There are a lot of questions lurking, such as soundness of any particular rules, complexity vs usefulness tradeoff, and certainly who if anyone might want to write code for it. I have a few other thoughts but discussions aren't appropriate for the bugtracker. I will likely hoist this to the 'features that aren't likely to be implemented' wiki page.
At least for the Git project folders, this could also be solved by ignoring files as indicated by .gitignore.