@@ -9,7 +9,7 @@ import Control.Monad.IO.Class
99import Data.Bool (bool)
1010import Data.Function (fix)
1111import Data.Maybe (isJust)
12−import Data.Semigroup ((<>))
12+import Data.Semigroup (Semigroup, (<>))
1313import qualified Data.Set as Set
1414import Data.String
1515import Data.Text (Text)
@@ -38,6 +38,18 @@ data ObRunState
3838 | ObRunState_BackendStarted Text -- Port of backend
3939 deriving (Eq, Show)
4040
41+doubleQuotes :: (IsString a, Semigroup a) => a -> a
42+doubleQuotes s = "\"" <> s <> "\""
43+
44+commit :: Text -> Sh ()
45+commit msg = void $ run "git"
46+ [ "commit"
47+ , "--no-gpg-sign"
48+ , "--allow-empty"
49+ , "-m"
50+ , doubleQuotes msg
51+ ]
52+
4153main :: IO ()
4254main = do
4355 isVerbose <- getArgs >>= \case
@@ -60,13 +72,11 @@ main = do
6072 assertRevEQ a b = liftIO . assertEqual "" "" =<< diff a b
6173 assertRevNE a b = liftIO . assertBool "" . (/= "") =<< diff a b
6274
63− doubleQuotes s = "\"" <> s <> "\""
64−
6575 revParseHead = T.strip <$> run "git" ["rev-parse", "HEAD"]
6676
6777 commitAll = do
6878 run "git" ["add", "."]
69− run "git" ["commit", "--allow-empty", "-m", doubleQuotes "checkpoint"]
79+ commit "checkpoint"
7080 revParseHead
7181
7282 thunk = ".obelisk/impl"
@@ -200,7 +210,7 @@ testThunkPack path = withTempFile (T.unpack $ toTextIgnore path) "test-file" $ \
200210 git ["add", T.pack file]
201211 -- Uncommitted files (staged)
202212 ensureThunkPackFails "unsaved modifications"
203− git ["commit", "-m", "test commit"]
213+ chdir path $ commit "test commit"
204214 -- Non-pushed commits in any branch
205215 ensureThunkPackFails "not been pushed"
206216 -- Uncommitted files (unstaged)