summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-14 11:28:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-14 11:28:49 -0400
commit1f66af2b53432802ad4a3a0f5a3b4f3863cd00ad (patch)
tree6e8b938301c94def04360fc20d72f93c5d92865f /Git
parentff5703ce77ffd4f911a74de9c7f6d0dd332185b2 (diff)
optimize away 3 stats
Diffstat (limited to 'Git')
-rw-r--r--Git/Construct.hs15
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