From 1f66af2b53432802ad4a3a0f5a3b4f3863cd00ad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 14 Jan 2012 11:28:49 -0400 Subject: optimize away 3 stats --- Git/Construct.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Git') diff --git a/Git/Construct.hs b/Git/Construct.hs index 1ad631ca4..fdc56a20a 100644 --- a/Git/Construct.hs +++ b/Git/Construct.hs @@ -239,14 +239,15 @@ seekUp want dir = do isRepoTop :: FilePath -> IO Bool isRepoTop dir = do r <- isRepo - b <- isBareRepo - return (r || b) + if r + then return r + else isBareRepo where - isRepo = gitSignature ".git" ".git/config" - isBareRepo = gitSignature "objects" "config" - gitSignature subdir file = liftM2 (&&) - (doesDirectoryExist (dir ++ "/" ++ subdir)) - (doesFileExist (dir ++ "/" ++ file)) + isRepo = gitSignature (".git" "config") + isBareRepo = (&&) + <$> doesDirectoryExist (dir "objects") + <*> gitSignature "config" + gitSignature file = doesFileExist (dir file) newFrom :: RepoLocation -> IO Repo newFrom l = return Repo -- cgit v1.2.3