Git: bareRepo

Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
This commit is contained in:
Félix Sipma 2014-11-23 18:42:36 +01:00 committed by Joey Hess
parent e8a07b1840
commit 226981cda4
1 changed files with 20 additions and 0 deletions

View File

@ -94,3 +94,23 @@ cloned owner url dir mbranch = check originurl (property desc checkout)
isGitDir :: FilePath -> IO Bool
isGitDir dir = isNothing <$> catchMaybeIO (readProcess "git" ["rev-parse", "--resolve-git-dir", dir])
data GitShared = Shared GroupName | SharedAll | NotShared
bareRepo :: FilePath -> UserName -> GitShared -> Property
bareRepo repo user gitshared = check (isRepo repo) $ propertyList ("git repo: " ++ repo) $
dirExists repo : case gitshared of
NotShared ->
[ ownerGroup repo user user
, userScriptProperty user ["git", "init", "--bare", "--shared=false", repo]
]
SharedAll ->
[ ownerGroup repo user user
, userScriptProperty user ["git", "init", "--bare", "--shared=all", repo]
]
Shared group' ->
[ ownerGroup repo user group'
, userScriptProperty user ["git", "init", "--bare", "--shared=group", repo]
]
where
isRepo repo' = isNothing <$> catchMaybeIO (readProcess "git" ["rev-parse", "--resolve-git-dir", repo'])