summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-10-04 13:52:03 -0400
committerJoey Hess2015-10-04 13:52:03 -0400
commit3337c5cc58d2671ace9e4b3b20223dd9fec9307a (patch)
treed1e534d58519df37e7eb244e33554021cb6f3932 /src
parent823d6e5cf5c154769826eae75b7a8e5333e41039 (diff)
parent1a9ce1af5a1d6c2aca063ed2f6e0bd13d1391192 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Gpg.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Propellor/Gpg.hs b/src/Propellor/Gpg.hs
index 84f67dc1..60b0d52d 100644
--- a/src/Propellor/Gpg.hs
+++ b/src/Propellor/Gpg.hs
@@ -6,6 +6,7 @@ import System.FilePath
import System.Directory
import Data.Maybe
import Data.List.Utils
+import Control.Monad
import Propellor.PrivData.Paths
import Propellor.Message
@@ -106,12 +107,14 @@ gitAdd f = boolSystem "git"
]
gitCommitKeyRing :: String -> IO Bool
-gitCommitKeyRing action = gitCommit
- [ File keyring
- , File privDataFile
- , Param "-m"
- , Param ("propellor " ++ action)
- ]
+gitCommitKeyRing action = do
+ -- Commit explicitly the keyring and privdata files, as other
+ -- changes may be staged by the user and shouldn't be committed.
+ tocommit <- filterM doesFileExist [ privDataFile, keyring]
+ gitCommit $ (map File tocommit) ++
+ [ Param "-m"
+ , Param ("propellor " ++ action)
+ ]
-- Adds --gpg-sign if there's a keyring.
gpgSignParams :: [CommandParam] -> IO [CommandParam]