diff options
| author | Félix Sipma <felix.sipma@no-log.org> | 2014-11-23 18:42:36 +0100 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-23 14:39:01 -0400 |
| commit | 226981cda4597f6564b9e31d826efc84a2ce61a5 (patch) | |
| tree | 333c8aa4a8e2542da65f399f99031df31f29c0a6 /src | |
| parent | e8a07b184014e307919be8921ee3029bae809048 (diff) | |
Git: bareRepo
Signed-off-by: Félix Sipma <felix.sipma@no-log.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/Git.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Propellor/Property/Git.hs b/src/Propellor/Property/Git.hs index 8d49cbd0..a2bec5ef 100644 --- a/src/Propellor/Property/Git.hs +++ b/src/Propellor/Property/Git.hs @@ -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']) |
