read inode cache file strictly to avoid failure to drop on windows

Seems that Windows doesn't allow deleting a file that the same process has open.
Here the inode cache file was read and a the value from it gets used later.
But due to laziness, the old file is still open when it gets deleted. Adding
strictness avoids this problem. Of course, the file is small, so it's no
problem to read it all strictly, so this is probably an improvement even
outside of Windows.
This commit is contained in:
Joey Hess 2013-05-13 19:29:52 -05:00
parent 73d2f8b280
commit 1093302eba

2
Annex/Content/Direct.hs Normal file → Executable file
View file

@ -110,7 +110,7 @@ goodContent key file = sameInodeCache file =<< recordedInodeCache key
recordedInodeCache :: Key -> Annex [InodeCache]
recordedInodeCache key = withInodeCacheFile key $ \f ->
liftIO $ catchDefaultIO [] $
mapMaybe readInodeCache . lines <$> readFile f
mapMaybe readInodeCache . lines <$> readFileStrict f
{- Caches an inode for a file.
-