From 9d975e9ee4c44782da0815fb161ea8676dbf559c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 23 Nov 2014 18:48:52 -0400 Subject: add --merge --- src/Propellor/Gpg.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Gpg.hs') diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs index 572be190..86f84dc1 100644 --- a/src/Propellor/Gpg.hs +++ b/src/Propellor/Gpg.hs @@ -83,14 +83,18 @@ addKey keyid = exitBool =<< allM (uncurry actionMessage) , Param "propellor addkey" ] +-- Adds --gpg-sign if there's a keyring. +gpgSignParams :: [CommandParam] -> IO [CommandParam] +gpgSignParams ps = ifM (doesFileExist keyring) + ( return (ps ++ [Param "--gpg-sign"]) + , return ps + ) + -- Automatically sign the commit if there'a a keyring. gitCommit :: [CommandParam] -> IO Bool gitCommit ps = do - k <- doesFileExist keyring - boolSystem "git" $ catMaybes $ - [ Just (Param "commit") - , if k then Just (Param "--gpg-sign") else Nothing - ] ++ map Just ps + ps' <- gpgSignParams ps + boolSystem "git" (Param "commit" : ps') gpgDecrypt :: FilePath -> IO String gpgDecrypt f = ifM (doesFileExist f) -- cgit v1.3-2-g0d8e