From d3085a4127babde653defb95bd054794c4df91dd Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 21 Jul 2014 10:48:49 +0200 Subject: [PATCH] Always ignore directory modification time (that stuff is nasty) --- model/puller.go | 19 +------------------ scanner/walk.go | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/model/puller.go b/model/puller.go index d6a65b5b8..4464e3151 100644 --- a/model/puller.go +++ b/model/puller.go @@ -9,7 +9,6 @@ import ( "errors" "os" "path/filepath" - "runtime" "time" "github.com/calmh/syncthing/config" @@ -278,22 +277,6 @@ func (p *puller) fixupDirectories() { } } - if cur.Modified != info.ModTime().Unix() { - t := time.Unix(cur.Modified, 0) - err := os.Chtimes(path, t, t) - if err != nil { - if runtime.GOOS != "windows" { - // https://code.google.com/p/go/issues/detail?id=8090 - l.Warnf("Restoring folder modtime: %q: %v", path, err) - } - } else { - changed++ - if debug { - l.Debugf("restored dir modtime: %d -> %v", info.ModTime().Unix(), cur) - } - } - } - return nil } @@ -373,7 +356,7 @@ func (p *puller) handleBlock(b bqBlock) bool { if debug { l.Debugf("create dir: %v", f) } - err = os.MkdirAll(path, 0777) + err = os.MkdirAll(path, os.FileMode(f.Flags&0777)) if err != nil { l.Warnf("Create folder: %q: %v", path, err) } diff --git a/scanner/walk.go b/scanner/walk.go index 2d114439d..3d1850ac7 100644 --- a/scanner/walk.go +++ b/scanner/walk.go @@ -166,7 +166,7 @@ func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo, ign map[string][ if w.CurrentFiler != nil { cf := w.CurrentFiler.CurrentFile(rn) permUnchanged := w.IgnorePerms || !protocol.HasPermissionBits(cf.Flags) || PermsEqual(cf.Flags, uint32(info.Mode())) - if !protocol.IsDeleted(cf.Flags) && cf.Modified == info.ModTime().Unix() && protocol.IsDirectory(cf.Flags) && permUnchanged { + if !protocol.IsDeleted(cf.Flags) && protocol.IsDirectory(cf.Flags) && permUnchanged { if debug { l.Debugln("unchanged:", cf) }