cache whether a repo is bare
This commit is contained in:
parent
586266e444
commit
93d2dc0d68
2 changed files with 6 additions and 4 deletions
|
@ -12,17 +12,19 @@ import Types
|
||||||
{- GitRepo constructor -}
|
{- GitRepo constructor -}
|
||||||
gitRepo :: FilePath -> IO GitRepo
|
gitRepo :: FilePath -> IO GitRepo
|
||||||
gitRepo dir = do
|
gitRepo dir = do
|
||||||
|
b <- isBareRepo dir
|
||||||
|
|
||||||
-- TOOD query repo for configuration settings; other repositories; etc
|
-- TOOD query repo for configuration settings; other repositories; etc
|
||||||
return GitRepo {
|
return GitRepo {
|
||||||
top = dir,
|
top = dir,
|
||||||
|
bare = b,
|
||||||
remotes = []
|
remotes = []
|
||||||
}
|
}
|
||||||
|
|
||||||
{- Path to a repository's gitattributes file. -}
|
{- Path to a repository's gitattributes file. -}
|
||||||
gitAttributes :: GitRepo -> IO String
|
gitAttributes :: GitRepo -> IO String
|
||||||
gitAttributes repo = do
|
gitAttributes repo = do
|
||||||
bare <- isBareRepo (top repo)
|
if (bare repo)
|
||||||
if (bare)
|
|
||||||
then return $ (top repo) ++ "/info/.gitattributes"
|
then return $ (top repo) ++ "/info/.gitattributes"
|
||||||
else return $ (top repo) ++ "/.gitattributes"
|
else return $ (top repo) ++ "/.gitattributes"
|
||||||
|
|
||||||
|
@ -31,8 +33,7 @@ gitAttributes repo = do
|
||||||
- TODO: support GIT_DIR -}
|
- TODO: support GIT_DIR -}
|
||||||
gitDir :: GitRepo -> IO String
|
gitDir :: GitRepo -> IO String
|
||||||
gitDir repo = do
|
gitDir repo = do
|
||||||
bare <- isBareRepo (top repo)
|
if (bare repo)
|
||||||
if (bare)
|
|
||||||
then return $ (top repo)
|
then return $ (top repo)
|
||||||
else return $ (top repo) ++ "/.git"
|
else return $ (top repo) ++ "/.git"
|
||||||
|
|
||||||
|
|
1
Types.hs
1
Types.hs
|
@ -21,6 +21,7 @@ data Backend = Backend {
|
||||||
-- a git repository
|
-- a git repository
|
||||||
data GitRepo = GitRepo {
|
data GitRepo = GitRepo {
|
||||||
top :: FilePath,
|
top :: FilePath,
|
||||||
|
bare :: Bool,
|
||||||
remotes :: [GitRepo]
|
remotes :: [GitRepo]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue