unison icon indicating copy to clipboard operation
unison copied to clipboard

Add option to synchronize directory timestamp

Open giorgiob opened this issue 7 years ago • 5 comments

unison provides the -times option, which synchronizes modification times for files. I would find it useful to synchronize modification times for folders as well. This is possible with other tools, e.g. rsync.

(I could try and implement the feature myself and submit a patch, but I would need some hints regarding the place in the code where modification time synchronization is implemented, since I am not familiar with unison's source code.)

giorgiob avatar Mar 09 '18 10:03 giorgiob

This would be a nontrivial change, unfortunately -- the places you'd have to touch are spread across the change detection (update.ml), reconciliation (recon.ml), and propagation (transport.ml) phases, and some of the code is pretty complex.

bcpierce00 avatar Mar 09 '18 12:03 bcpierce00

an option is to run rsync after unison to sync dir times but you have to be careful of the exceptions in your unison profile.

li-ruijie avatar Mar 22 '18 12:03 li-ruijie

I am currently using rsync to synchronize between different computers. It requires some discipline because I always have to check out the current state from a server before I start working and then push the modification before I shut down my computer.

I would like to use unison instead because it allows to choose interactively how to reconcile individual files and their properties (including the files' timestamps). Unfortunately I cannot reconcile folder timestamps in the same way and this means that after reconciling a folder from different computers, the folder timestamp will not be the time I last worked on that folder but the time I last reconciled it.

I have looked into the code and indeed it is quite complex and I am afraid that at the moment I cannot invest enough time to contribute something meaningful. If I get some more time to work on this I will give it another try.

giorgiob avatar Apr 15 '18 09:04 giorgiob

Workaround: afterwards, run:

rsync -r --times --size-only --existing

HaleTom avatar Oct 08 '19 05:10 HaleTom

The problem with using vanilla rsync is that it won't sync bidirectionally, which is the main strength of unison.

protist avatar Oct 08 '19 07:10 protist