robustness fixes for empty or missing trust log
This commit is contained in:
parent
8d6da87eec
commit
730c273eae
1 changed files with 5 additions and 1 deletions
6
UUID.hs
6
UUID.hs
|
@ -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. -}
|
||||||
|
|
Loading…
Reference in a new issue