summaryrefslogtreecommitdiff
path: root/Annex/Content
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-02-03 10:20:18 -0400
committerJoey Hess <joey@kitenet.net>2014-02-03 10:20:18 -0400
commit08afe3a1f6953ec6b895a7880229c09258e97013 (patch)
tree1b535a243df2aa11ddb20f8246e0375fdfc662cb /Annex/Content
parent1572c460e86a048e9f2419a42646898b7982d5af (diff)
fix failing test case on Windows
ensure file being modified is all read before it's opened for write
Diffstat (limited to 'Annex/Content')
-rw-r--r--Annex/Content/Direct.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs
index f897cca6ae..b60ab9b1b3 100644
--- a/Annex/Content/Direct.hs
+++ b/Annex/Content/Direct.hs
@@ -54,7 +54,10 @@ associatedFilesRelative key = do
mapping <- calcRepo $ gitAnnexMapping key
liftIO $ catchDefaultIO [] $ withFile mapping ReadMode $ \h -> do
fileEncoding h
- lines <$> hGetContents h
+ -- Read strictly to ensure the file is closed
+ -- before changeAssociatedFiles tries to write to it.
+ -- (Especially needed on Windows.)
+ lines <$> hGetContentsStrict h
{- Changes the associated files information for a key, applying a
- transformation to the list. Returns new associatedFiles value. -}