aboutsummaryrefslogtreecommitdiff
path: root/Annex/Content
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-03 10:20:18 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-03 10:20:18 -0400
commitd14a82f0334f299b055b8a3feefdc164d06ee9f2 (patch)
treefac0199b3ad4ce539ae7c8ba74c22913e9c29ba2 /Annex/Content
parent19fee049f6dfba4d4294e16d6d530bc7d0e78c54 (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 f897cca6a..b60ab9b1b 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. -}