aboutsummaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-02-17 14:04:43 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-02-17 14:04:43 -0400
commit615053c624b357520ef01db60c58e60d848a44bd (patch)
tree90bcd7299da5767ddab3eaabb335c55b9a13a9be /Git
parent5b64144c2fb989f9799c1ec328b442b504b1d10f (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')
-rw-r--r--Git/ConfigTypes.hs (renamed from Git/SharedRepository.hs)18
1 files changed, 15 insertions, 3 deletions
diff --git a/Git/SharedRepository.hs b/Git/ConfigTypes.hs
index 1e7382388..af3dc976d 100644
--- a/Git/SharedRepository.hs
+++ b/Git/ConfigTypes.hs
@@ -1,11 +1,11 @@
-{- git core.sharedRepository handling
+{- git config types
-
- - Copyright 2012 Joey Hess <id@joeyh.name>
+ - Copyright 2012, 2017 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
-module Git.SharedRepository where
+module Git.ConfigTypes where
import Data.Char
@@ -14,6 +14,7 @@ import Git
import qualified Git.Config
data SharedRepository = UnShared | GroupShared | AllShared | UmaskShared Int
+ deriving (Eq)
getSharedRepository :: Repo -> SharedRepository
getSharedRepository r =
@@ -26,3 +27,14 @@ getSharedRepository r =
"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