summaryrefslogtreecommitdiff
path: root/src/Propellor/Git.hs
diff options
context:
space:
mode:
authorFĂ©lix Sipma2016-01-03 16:13:11 +0100
committerJoey Hess2016-01-03 16:35:37 -0400
commitd5c8e05b750e4251b96becd78bd9faef634482f3 (patch)
treea34370435d180fc7dcd531270e4daf1f67120a0b /src/Propellor/Git.hs
parent93ee9e6966783368fa41fb75c7e287bee04f9c16 (diff)
Gpg: use gpg.program from git config
(cherry picked from commit dd572a741f1ca4bce8f984c350d9045d979f1813)
Diffstat (limited to 'src/Propellor/Git.hs')
-rw-r--r--src/Propellor/Git.hs19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/Propellor/Git.hs b/src/Propellor/Git.hs
index a2f5aef2..3ad8e0f4 100644
--- a/src/Propellor/Git.hs
+++ b/src/Propellor/Git.hs
@@ -6,11 +6,11 @@ import Propellor.Gpg
import Utility.FileMode
getCurrentBranch :: IO String
-getCurrentBranch = takeWhile (/= '\n')
+getCurrentBranch = takeWhile (/= '\n')
<$> readProcess "git" ["symbolic-ref", "--short", "HEAD"]
getCurrentBranchRef :: IO String
-getCurrentBranchRef = takeWhile (/= '\n')
+getCurrentBranchRef = takeWhile (/= '\n')
<$> readProcess "git" ["symbolic-ref", "HEAD"]
getCurrentGitSha1 :: String -> IO String
@@ -29,15 +29,6 @@ setRepoUrl url = do
void $ boolSystem "git" [Param "config", Param (branchval "remote"), Param "origin"]
void $ boolSystem "git" [Param "config", Param (branchval "merge"), Param $ "refs/heads/"++branch]
-getGitConfigValue :: String -> IO (Maybe String)
-getGitConfigValue key = do
- value <- catchMaybeIO $
- takeWhile (/= '\n')
- <$> readProcess "git" ["config", key]
- return $ case value of
- Just v | not (null v) -> Just v
- _ -> Nothing
-
-- `git config --bool propellor.blah` outputs "false" if propellor.blah is unset
-- i.e. the git convention is that the default value of any git-config setting
-- is "false". So we don't need a Maybe Bool here.
@@ -92,9 +83,9 @@ fetchOrigin = do
void $ actionMessage "Pull from central git repository" $
boolSystem "git" [Param "fetch"]
-
+
oldsha <- getCurrentGitSha1 branchref
-
+
whenM (doesFileExist keyring) $
ifM (verifyOriginBranch originbranch)
( do
@@ -103,6 +94,6 @@ fetchOrigin = do
void $ boolSystem "git" [Param "merge", Param originbranch]
, warningMessage $ "git branch " ++ originbranch ++ " is not signed with a trusted gpg key; refusing to deploy it! (Running with previous configuration instead.)"
)
-
+
newsha <- getCurrentGitSha1 branchref
return $ oldsha /= newsha