mutagen-io / mutagen

Fast file synchronization and network forwarding for remote development
https://mutagen.io
Other
3.47k stars 153 forks source link

Ability to synchronize timestamps #485

Open eauchat opened 8 months ago

eauchat commented 8 months ago

I'm using mutagen 0.17.5 to synchronize some directories between a linux laptop and linux server (both debian based). Synchronization is working well, but when I close it for a while and make modifications to both sides, it's simpler and more reliable for me to use rsync to resolve conflicts manually, before restarting mutagen. The issue is that rsync watch timestamps and wants to synchronize everything, to correct inappropriate timestamps. Which makes it inconvenient to identify real modifications. I could ask rsync to ignore timestamps, but it's not ideal for various reasons.

So I was wondering why mutagen does not synchronize timestamps, or if there is an option I didn't find to have it do it. I searched extensively, but somehow didn't find relevant info on this aspect. But maybe I didn't search in the right places.

Thanks for your attention, and thanks for the great tool you've created.

scruel commented 8 months ago

Along with other metadata info like owner, group, ACLs, xattr, etc.

scruel commented 8 months ago

Workaround (only owner/access/timestamp, on the same machine):

SOURCE=$1
TARGET=$2

find "$SOURCE" $@ -print0 | while IFS= read -r -d '' file; do
  rel_path="${file#$SOURCE}"
  target_path="$TARGET$rel_path"
  echo $target_path
  if [ -e "$target_path" ]; then
    echo 1
    #touch -r "$file" "$target_path"
    #chown --reference="$file" "$target_path"
    #chmod --reference="$file" "$target_path"
  fi
done