robustness fix

don't crash if an object directory does not contain a file
This commit is contained in:
Joey Hess 2010-12-02 21:26:37 -04:00
parent 83a87a5229
commit 71d60eb87a

View file

@ -190,9 +190,11 @@ getKeysPresent' dir = do
return $ map fileKey files
where
present d = do
s <- getFileStatus $ dir ++ "/" ++ d ++ "/"
++ takeFileName d
return $ isRegularFile s
result <- try $
getFileStatus $ dir ++ "/" ++ d ++ "/" ++ takeFileName d
case result of
Right s -> return $ isRegularFile s
Left _ -> return False
{- List of keys referenced by symlinks in the git repo. -}
getKeysReferenced :: Annex [Key]