I'm trying to use Unison to synchronize files between my host machine on Windows and my guest VM on Fedora Linux.
I want all conflicts to be managed automatically:
- all conflicts must be resolved in favour of the host (Windows) by default
- a few selected dirs must be resolved in favour of the guest (Fedora)
Here is my default.prf
file:
root = c:\www
root = socket://192.168.40.100:9999//home/ben/www
# only synchronize these dirs
path = site1.com
path = site2.com
# do not synchronize PHPStorm's config
ignore = Name .idea
# resolve conflicts in favour of the host by default
prefer = c:\www
# resolve directories managed by CLI commands on the guest in favour of the guest
preferpartial = BelowPath site1.com/node_modules -> socket://192.168.40.100:9999//home/ben/www
preferpartial = BelowPath site1.com/public/build -> socket://192.168.40.100:9999//home/ben/www
preferpartial = BelowPath site1.com/var -> socket://192.168.40.100:9999//home/ben/www
preferpartial = BelowPath site1.com/vendor -> socket://192.168.40.100:9999//home/ben/www
preferpartial = BelowPath site2.com/node_modules -> socket://192.168.40.100:9999//home/ben/www
preferpartial = BelowPath site2.com/vendor -> socket://192.168.40.100:9999//home/ben/www
# automatically accept default (nonconflicting) actions
auto = true
# don't keep backup copies
backups = false
# batch mode: ask no questions at all
batch = true
# synchronize continuously (watch for changes)
repeat = watch
The above config doesn't work at all: when I create conflicting files in the host and the guest, inside and outside preferpartial
directories, the conflicts are alternatively either all resolved in favour of the guest, or all in favour of the host.
(I've setup a test script where I create conflicting files with "HOST" or "GUEST" contents, start Unison, then cat
the files once Unison has finished syncing).
What am I doing wrong?