avoid partial function

This commit is contained in:
Joey Hess 2011-12-15 16:58:58 -04:00
parent fbc3d32f7d
commit 0f9859ae51

View file

@ -90,7 +90,8 @@ gitAnnexLocation key r
return $ inrepo ".git" </> annexLocation key hashDirMixed
where
inrepo d = Git.workTree r </> d
check locs = fromMaybe (head locs) <$> firstM doesFileExist locs
check locs@(l:_) = fromMaybe l <$> firstM doesFileExist locs
check [] = error "internal"
{- The annex directory of a repository. -}
gitAnnexDir :: Git.Repo -> FilePath