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
where
isRepo = gitSignature (".git" </> "config")
isBareRepo = (&&)
<$> doesDirectoryExist (dir </> "objects")
<*> gitSignature "config"
isBareRepo = do
e <- doesDirectoryExist (dir </> "objects")
if not e
then return e
else gitSignature "config"
gitSignature file = doesFileExist (dir </> file)
newFrom :: RepoLocation -> IO Repo