summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Git.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/Git.hs')
-rw-r--r--src/Propellor/Property/Git.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Propellor/Property/Git.hs b/src/Propellor/Property/Git.hs
index 46f6abc7..1deda951 100644
--- a/src/Propellor/Property/Git.hs
+++ b/src/Propellor/Property/Git.hs
@@ -149,3 +149,13 @@ repoAcceptsNonFFs repo = accepts <!> refuses
refuses = repoConfigured repo ("receive.denyNonFastForwards", "true")
`describe` desc "rejects"
desc s = "git repo " ++ repo ++ " " ++ s ++ " non-fast-forward pushes"
+
+-- | Sets a bare repository's default branch.
+bareRepoDefaultBranch :: FilePath -> String -> Property NoInfo
+bareRepoDefaultBranch repo branch =
+ userScriptProperty (User "root")
+ [ "cd " ++ repo
+ , "git symbolic-ref HEAD refs/heads/" ++ branch
+ ]
+ `changesFileContent` (repo </> "HEAD")
+ `describe` ("git repo at " ++ repo ++ " has default branch " ++ branch)