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 :: FilePath -> UnusedLog -> Annex ()
writeUnusedLog prefix l = do writeUnusedLog prefix l = do
logfile <- fromRepo $ gitAnnexUnusedLog prefix 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 where
format (k, (i, Just t)) = show i ++ " " ++ key2file k ++ " " ++ show t format (k, (i, Just t)) = show i ++ " " ++ key2file k ++ " " ++ show t
format (k, (i, Nothing)) = show i ++ " " ++ key2file k format (k, (i, Nothing)) = show i ++ " " ++ key2file k
@ -77,7 +77,7 @@ readUnusedLog prefix = do
f <- fromRepo $ gitAnnexUnusedLog prefix f <- fromRepo $ gitAnnexUnusedLog prefix
ifM (liftIO $ doesFileExist f) ifM (liftIO $ doesFileExist f)
( M.fromList . mapMaybe parse . lines ( M.fromList . mapMaybe parse . lines
<$> liftIO (readFile f) <$> liftIO (readFileStrictAnyEncoding f)
, return M.empty , return M.empty
) )
where where

1
debian/changelog vendored
View file

@ -19,6 +19,7 @@ git-annex (5.20140307) UNRELEASED; urgency=medium
* Better workaround for problem umasks when eg, setting up ssh keys. * Better workaround for problem umasks when eg, setting up ssh keys.
* "standard" can now be used as a first-class keyword in preferred content * "standard" can now be used as a first-class keyword in preferred content
expressions. For example "standard or (include=otherdir/*)" expressions. For example "standard or (include=otherdir/*)"
* Avoid encoding errors when using the unused log file.
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400 -- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400