I am using unison to synchronize two computers, and generally I would like to ignore all hidden files except a few. I have a unison preference file (default.prf) that looks as follows:

# Unison preferences file

# keep time stamps
times = true
auto = true

ignore = Name .*

path = Documents
path = .hgrc
path = .vimrc

Even though I'd like most hidden files to be ignore, I'd like .hgrc and .vimrc to be synced between the two computers. However, with the setup above they are ignored too. How can I fix the problem of syncing them?


According to http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#prefs, "ignorenot" may be useful here.

This preference overrides the preference ignore. It gives a list of patterns (in the same format as ignore) for paths that should definitely not be ignored, whether or not they happen to match one of the ignore patterns.

I'm not an experienced Unison user, so I don't know if the following caveat applies here:

Note that the semantics of ignore and ignorenot is a little counter-intuitive. When detecting updates, Unison examines paths in depth-first order, starting from the roots of the replicas and working downwards. Before examining each path, it checks whether it matches ignore and does not match ignorenot; in this case it skips this path and all its descendants. This means that, if some parent of a given path matches an ignore pattern, then it will be skipped even if the path itself matches an ignorenot pattern. In particular, putting ignore = Path * in your profile and then using ignorenot to select particular paths to be synchronized will not work. Instead, you should use the path preference to choose particular paths to synchronize.

I realize this comes more than a month after your question. Still, I hope it's useful.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.