From 31745ac13b1c6ef07d5bf5fd8f497002f5094081 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 28 Nov 2012 17:42:12 +0000 Subject: [PATCH] Update the mtime of the remote object when size and md5sum match but mtime doesn't --- swiftsync.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/swiftsync.go b/swiftsync.go index 2acc31cbe..e91ca44fb 100644 --- a/swiftsync.go +++ b/swiftsync.go @@ -76,11 +76,9 @@ func (fs *FsObject) md5sum() (string, error) { // // If the size is the same and and mtime is different or unreadable // and the MD5SUM is the same then the file is considered to be -// unchanged. +// unchanged. In this case the mtime on the object is updated. // // Otherwise the file is considered to be changed. -// -// FIXME should update the checksum of the remote object with the mtime func (fs *FsObject) changed(c *swift.Connection, container string) bool { obj, h, err := c.Object(container, fs.rel) if err != nil { @@ -118,7 +116,14 @@ func (fs *FsObject) changed(c *swift.Connection, container string) bool { return true } - // FIXME update the mtime of the remote object here + // Update the mtime of the remote object here + m.SetModTime(fs.info.ModTime()) + err = c.ObjectUpdate(container, fs.rel, m.ObjectHeaders()) + if err != nil { + fs.Debugf("Failed to update mtime: %s", err) + } + fs.Debugf("Updated mtime") + fs.Debugf("Size and MD5SUM identical - skipping") return false }