summaryrefslogtreecommitdiff
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
parent19fee049f6dfba4d4294e16d6d530bc7d0e78c54 (diff)
fix failing test case on Windows
ensure file being modified is all read before it's opened for write
-rw-r--r--Annex/Content/Direct.hs5
-rw-r--r--Remote/Bup.hs2
-rw-r--r--doc/todo/windows_support.mdwn4
3 files changed, 5 insertions, 6 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. -}
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index 7395b7428..62af704b2 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -145,7 +145,7 @@ storeEncrypted r buprepo (cipher, enck) k _p =
retrieve :: BupRepo -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex Bool
retrieve buprepo k _f d _p = do
let params = bupParams "join" buprepo [Param $ bupRef k]
- liftIO $ catchBoolIO $ withFIle d WriteMode $
+ liftIO $ catchBoolIO $ withFile d WriteMode $
pipeBup params Nothing . Just
retrieveCheap :: BupRepo -> Key -> FilePath -> Annex Bool
diff --git a/doc/todo/windows_support.mdwn b/doc/todo/windows_support.mdwn
index 450dbbeff..f6d08d25d 100644
--- a/doc/todo/windows_support.mdwn
+++ b/doc/todo/windows_support.mdwn
@@ -12,10 +12,6 @@ now! --[[Joey]]
is much slower than on systems supporting connection caching.
* The test suite does not 100% pass, although it seems to be getting
quite close! Current known failures:
- * unannex test fails, but only around 50% or less of the time,
- while updating the .map file. Renaming the new file into place fails
- with permission denied. Possibly something else has the file
- open?
* "conflict_resolution (mixed directory and file)" test fails;
not because the conflict resolution fails, but the sync fails
pushing to synced/master with a non-fast-forward failure.