diff options
author | Joey Hess <joey@kitenet.net> | 2014-06-12 13:43:16 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-06-12 13:54:08 -0400 |
commit | 624a9aba5adf8df8f0d9583454bf808842c3e15c (patch) | |
tree | 1cfbed8db158ad1e2d9b902cd8082f14a2e13fd9 /Annex | |
parent | 34c9eab951a73f06de70170cc2c2d40ce490ea70 (diff) |
finish fixing windows timezone madness
Rather than calculating the TSDelta once, and caching it, this now
reads the inode sential file's InodeCache file once, and then each time a
new InodeCache is generated, looks at the sentinal file to get the current
delta.
This way, if the time zone changes while git-annex is running, it will
adapt.
This adds some inneffiency, but only on Windows, and only 1 stat per new
file added. The worst innefficiency is that `git annex status` and
`git annex sync` will now (on Windows) stat the inode sentinal file once per
file in the repo.
It would be more efficient to use getCurrentTimeZone, rather than needing
to stat the sentinal file. This should be easy to do, once the time
package gets my bugfix patch.
This commit was sponsored by Jürgen Lüters.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content/Direct.hs | 4 | ||||
-rw-r--r-- | Annex/Direct.hs | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index 2d271eee4..b249e0557 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -175,9 +175,9 @@ sameInodeCache file old = go =<< withTSDelta (liftIO . genInodeCache file) {- Checks if a FileStatus matches the recorded InodeCache of a file. -} sameFileStatus :: Key -> FileStatus -> Annex Bool -sameFileStatus key status = withTSDelta $ \delta -> do +sameFileStatus key status = do old <- recordedInodeCache key - let curr = toInodeCache delta status + curr <- withTSDelta $ \delta -> liftIO $ toInodeCache delta status case (old, curr) of (_, Just c) -> elemInodeCaches c old ([], Nothing) -> return True diff --git a/Annex/Direct.hs b/Annex/Direct.hs index e3dbfb6d8..5442113af 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -56,8 +56,9 @@ stageDirect = do go (file, Just sha, Just mode) = withTSDelta $ \delta -> do shakey <- catKey sha mode mstat <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file + mcache <- liftIO $ maybe (pure Nothing) (toInodeCache delta) mstat filekey <- isAnnexLink file - case (shakey, filekey, mstat, toInodeCache delta =<< mstat) of + case (shakey, filekey, mstat, mcache) of (_, Just key, _, _) | shakey == filekey -> noop {- A changed symlink. -} |