2017-02-17 18:04:43 +00:00
|
|
|
{- git config types
|
2012-04-21 18:06:36 +00:00
|
|
|
-
|
2017-02-17 18:04:43 +00:00
|
|
|
- Copyright 2012, 2017 Joey Hess <id@joeyh.name>
|
2012-04-21 18:06:36 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2017-02-17 18:04:43 +00:00
|
|
|
module Git.ConfigTypes where
|
2012-04-21 18:06:36 +00:00
|
|
|
|
|
|
|
import Data.Char
|
|
|
|
|
|
|
|
import Common
|
|
|
|
import Git
|
|
|
|
import qualified Git.Config
|
|
|
|
|
|
|
|
data SharedRepository = UnShared | GroupShared | AllShared | UmaskShared Int
|
2017-02-17 18:04:43 +00:00
|
|
|
deriving (Eq)
|
2012-04-21 18:06:36 +00:00
|
|
|
|
|
|
|
getSharedRepository :: Repo -> SharedRepository
|
|
|
|
getSharedRepository r =
|
|
|
|
case map toLower $ Git.Config.get "core.sharedrepository" "" r of
|
|
|
|
"1" -> GroupShared
|
2015-07-06 19:25:41 +00:00
|
|
|
"2" -> AllShared
|
2012-04-21 18:06:36 +00:00
|
|
|
"group" -> GroupShared
|
|
|
|
"true" -> GroupShared
|
|
|
|
"all" -> AllShared
|
|
|
|
"world" -> AllShared
|
|
|
|
"everybody" -> AllShared
|
|
|
|
v -> maybe UnShared UmaskShared (readish v)
|
2017-02-17 18:04:43 +00:00
|
|
|
|
|
|
|
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
|