2012-04-21 18:06:36 +00:00
|
|
|
{- git core.sharedRepository handling
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-04-21 18:06:36 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Git.SharedRepository where
|
|
|
|
|
|
|
|
import Data.Char
|
|
|
|
|
|
|
|
import Common
|
|
|
|
import Git
|
|
|
|
import qualified Git.Config
|
|
|
|
|
|
|
|
data SharedRepository = UnShared | GroupShared | AllShared | UmaskShared Int
|
|
|
|
|
|
|
|
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)
|