optimize away 3 stats
This commit is contained in:
parent
ff5703ce77
commit
1f66af2b53
1 changed files with 8 additions and 7 deletions
|
@ -239,14 +239,15 @@ seekUp want dir = do
|
||||||
isRepoTop :: FilePath -> IO Bool
|
isRepoTop :: FilePath -> IO Bool
|
||||||
isRepoTop dir = do
|
isRepoTop dir = do
|
||||||
r <- isRepo
|
r <- isRepo
|
||||||
b <- isBareRepo
|
if r
|
||||||
return (r || b)
|
then return r
|
||||||
|
else isBareRepo
|
||||||
where
|
where
|
||||||
isRepo = gitSignature ".git" ".git/config"
|
isRepo = gitSignature (".git" </> "config")
|
||||||
isBareRepo = gitSignature "objects" "config"
|
isBareRepo = (&&)
|
||||||
gitSignature subdir file = liftM2 (&&)
|
<$> doesDirectoryExist (dir </> "objects")
|
||||||
(doesDirectoryExist (dir ++ "/" ++ subdir))
|
<*> gitSignature "config"
|
||||||
(doesFileExist (dir ++ "/" ++ file))
|
gitSignature file = doesFileExist (dir </> file)
|
||||||
|
|
||||||
newFrom :: RepoLocation -> IO Repo
|
newFrom :: RepoLocation -> IO Repo
|
||||||
newFrom l = return Repo
|
newFrom l = return Repo
|
||||||
|
|
Loading…
Reference in a new issue