diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-14 11:28:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-14 11:28:49 -0400 |
commit | 1f66af2b53432802ad4a3a0f5a3b4f3863cd00ad (patch) | |
tree | 6e8b938301c94def04360fc20d72f93c5d92865f | |
parent | ff5703ce77ffd4f911a74de9c7f6d0dd332185b2 (diff) |
optimize away 3 stats
-rw-r--r-- | Git/Construct.hs | 15 |
1 files changed, 8 insertions, 7 deletions
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 |