From 34c9eab951a73f06de70170cc2c2d40ce490ea70 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 11 Jun 2014 17:51:12 -0400 Subject: fix for Windows file timestamp timezone madness On Windows, changing the time zone causes the apparent mtime of files to change. This confuses git-annex, which natually thinks this means the files have actually been modified (since THAT'S WHAT A MTIME IS FOR, BILL ). Work around this stupidity, by using the inode sentinal file to detect if the timezone has changed, and calculate a TSDelta, which will be applied when generating InodeCaches. This should add no overhead at all on unix. Indeed, I sped up a few things slightly in the refactoring. Seems to basically work! But it has a big known problem: If the timezone changes while the assistant (or a long-running command) runs, it won't notice, since it only checks the inode cache once, and so will use the old delta for all new inode caches it generates for new files it's added. Which will result in them seeming changed the next time it runs. This commit was sponsored by Vincent Demeester. --- Annex.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Annex.hs') diff --git a/Annex.hs b/Annex.hs index bb0b6f084..bb271c5e8 100644 --- a/Annex.hs +++ b/Annex.hs @@ -32,10 +32,6 @@ module Annex ( withCurrentState, ) where -import "mtl" Control.Monad.Reader -import Control.Monad.Catch -import Control.Concurrent - import Common import qualified Git import qualified Git.Config @@ -62,11 +58,16 @@ import Types.LockPool import Types.MetaData import Types.DesktopNotify import Types.CleanupActions -import qualified Data.Map as M -import qualified Data.Set as S #ifdef WITH_QUVI import Utility.Quvi (QuviVersion) #endif +import Utility.InodeCache + +import "mtl" Control.Monad.Reader +import Control.Monad.Catch +import Control.Concurrent +import qualified Data.Map as M +import qualified Data.Set as S {- git-annex's monad is a ReaderT around an AnnexState stored in a MVar. - This allows modifying the state in an exception-safe fashion. @@ -120,7 +121,7 @@ data AnnexState = AnnexState , fields :: M.Map String String , modmeta :: [ModMeta] , cleanup :: M.Map CleanupAction (Annex ()) - , inodeschanged :: Maybe Bool + , sentinalstatus :: Maybe SentinalStatus , useragent :: Maybe String , errcounter :: Integer , unusedkeys :: Maybe (S.Set Key) @@ -165,7 +166,7 @@ newState c r = AnnexState , fields = M.empty , modmeta = [] , cleanup = M.empty - , inodeschanged = Nothing + , sentinalstatus = Nothing , useragent = Nothing , errcounter = 0 , unusedkeys = Nothing -- cgit v1.2.3