robustness fixes for empty or missing trust log

This commit is contained in:
Joey Hess 2011-01-11 18:49:32 -04:00
parent 8d6da87eec
commit 730c273eae

View file

@ -145,8 +145,12 @@ getTrusted :: Annex [UUID]
getTrusted = do getTrusted = do
logfile <- trustLog logfile <- trustLog
s <- liftIO $ catch (readFile logfile) ignoreerror s <- liftIO $ catch (readFile logfile) ignoreerror
return $ map (\l -> head $ words l) $ lines s return $ parse s
where where
parse [] = []
parse s = map firstword $ lines s
firstword [] = ""
firstword l = head $ words l
ignoreerror _ = return "" ignoreerror _ = return ""
{- Changes the list of trusted UUIDs. -} {- Changes the list of trusted UUIDs. -}