diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-02-17 14:04:43 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-02-17 14:04:43 -0400 |
commit | 615053c624b357520ef01db60c58e60d848a44bd (patch) | |
tree | 90bcd7299da5767ddab3eaabb335c55b9a13a9be /Git/ConfigTypes.hs | |
parent | 5b64144c2fb989f9799c1ec328b442b504b1d10f (diff) |
post-recive hook to make updateInstead work in direct mode and adjusted branches
* Added post-recieve hook, which makes updateInstead work with direct
mode and adjusted branches.
* init: Set up the post-receive hook.
This commit was sponsored by Fernando Jimenez on Patreon.
Diffstat (limited to 'Git/ConfigTypes.hs')
-rw-r--r-- | Git/ConfigTypes.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Git/ConfigTypes.hs b/Git/ConfigTypes.hs new file mode 100644 index 000000000..af3dc976d --- /dev/null +++ b/Git/ConfigTypes.hs @@ -0,0 +1,40 @@ +{- git config types + - + - Copyright 2012, 2017 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Git.ConfigTypes where + +import Data.Char + +import Common +import Git +import qualified Git.Config + +data SharedRepository = UnShared | GroupShared | AllShared | UmaskShared Int + deriving (Eq) + +getSharedRepository :: Repo -> SharedRepository +getSharedRepository r = + case map toLower $ Git.Config.get "core.sharedrepository" "" r of + "1" -> GroupShared + "2" -> AllShared + "group" -> GroupShared + "true" -> GroupShared + "all" -> AllShared + "world" -> AllShared + "everybody" -> AllShared + v -> maybe UnShared UmaskShared (readish v) + +data DenyCurrentBranch = UpdateInstead | RefusePush | WarnPush | IgnorePush + deriving (Eq) + +getDenyCurrentBranch :: Repo -> DenyCurrentBranch +getDenyCurrentBranch r = + case map toLower $ Git.Config.get "receive.denycurrentbranch" "" r of + "updateinstead" -> UpdateInstead + "warn" -> WarnPush + "ignore" -> IgnorePush + _ -> RefusePush |