avoid unnecessary stats when traversing to parent

This commit is contained in:
Joey Hess 2012-01-14 11:48:10 -04:00
parent 92a4af8b20
commit 8c87293b48

View file

@ -244,9 +244,11 @@ isRepoTop dir = do
else isBareRepo else isBareRepo
where where
isRepo = gitSignature (".git" </> "config") isRepo = gitSignature (".git" </> "config")
isBareRepo = (&&) isBareRepo = do
<$> doesDirectoryExist (dir </> "objects") e <- doesDirectoryExist (dir </> "objects")
<*> gitSignature "config" if not e
then return e
else gitSignature "config"
gitSignature file = doesFileExist (dir </> file) gitSignature file = doesFileExist (dir </> file)
newFrom :: RepoLocation -> IO Repo newFrom :: RepoLocation -> IO Repo