Avoid encoding errors when using the unused log file.

This commit is contained in:
Joey Hess 2014-03-15 11:57:27 -04:00
parent f8112d82f2
commit b7eb1d834a
2 changed files with 3 additions and 2 deletions

View file

@ -67,7 +67,7 @@ updateUnusedLog prefix m = do
writeUnusedLog :: FilePath -> UnusedLog -> Annex ()
writeUnusedLog prefix l = do
logfile <- fromRepo $ gitAnnexUnusedLog prefix
liftIO $ viaTmp writeFile logfile $ unlines $ map format $ M.toList l
liftIO $ viaTmp writeFileAnyEncoding logfile $ unlines $ map format $ M.toList l
where
format (k, (i, Just t)) = show i ++ " " ++ key2file k ++ " " ++ show t
format (k, (i, Nothing)) = show i ++ " " ++ key2file k
@ -77,7 +77,7 @@ readUnusedLog prefix = do
f <- fromRepo $ gitAnnexUnusedLog prefix
ifM (liftIO $ doesFileExist f)
( M.fromList . mapMaybe parse . lines
<$> liftIO (readFile f)
<$> liftIO (readFileStrictAnyEncoding f)
, return M.empty
)
where