Question

I am using unison to sync a bunch of folders together. Not just 2 roots, but I think my question can be made this simple...

Lets say I am syncing directory A and B using unison. If I remove file X from directory A, how does unison know what to do? Should it add X back to A from B or should it delete X from B?

Was it helpful?

Solution

Unison keeps a record of the contents of each path after each successful synchronization of that path (i.e., it remembers the contents at the last moment when they were the same in the two replicas).

We say that a path is updated (in some replica) if its current contents are different from its contents the last time it was successfully synchronized. Note that whether a path is updated has nothing to do with its last modification time—Unison considers only the contents when determining whether an update has occurred. This means that touching a file without changing its contents will not be recognized as an update. A file can even be changed several times and then changed back to its original contents; as long as Unison is only run at the end of this process, no update will be recognized.

In other words: Unison knows that you have deleted file X, because it's no longer on the disk in A, it knows it should delete it from B.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top