From 226981cda4597f6564b9e31d826efc84a2ce61a5 Mon Sep 17 00:00:00 2001 From: Félix Sipma Date: Sun, 23 Nov 2014 18:42:36 +0100 Subject: Git: bareRepo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Félix Sipma --- src/Propellor/Property/Git.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Propellor/Property/Git.hs') 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']) -- cgit v1.3-2-g0d8e From 3c952a0de9d228eafe6e208007be7d2e018d68b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 23 Nov 2014 14:40:28 -0400 Subject: comment --- src/Propellor/Property/Git.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property/Git.hs') diff --git a/src/Propellor/Property/Git.hs b/src/Propellor/Property/Git.hs index a2bec5ef..eb7801c1 100644 --- a/src/Propellor/Property/Git.hs +++ b/src/Propellor/Property/Git.hs @@ -57,8 +57,9 @@ type Branch = String -- | Specified git repository is cloned to the specified directory. -- --- If the firectory exists with some other content, it will be recursively --- deleted. +-- If the directory exists with some other content (either a non-git +-- repository, or a git repository cloned from some other location), +-- it will be recursively deleted first. -- -- A branch can be specified, to check out. cloned :: UserName -> RepoUrl -> FilePath -> Maybe Branch -> Property -- cgit v1.3-2-g0d8e