on master help sign in
Pass git user config options to git stash

This is needed on a Nixos 18.09 machine with git 2.18 but not needed on a 19.09 machine. In the future, we should consider not depending on whatever git is installed and instead hardcoding it to the nix store path.

commit04d4384af8a84b102d39fb3ea6667c03dbc98cd3 authorAriel Nunez <ingenieroariel@gmail.com> dateThu 9 Jan 2020, 16:41 (7 years ago) parente98f10e
1 file changed+5−8
lib/selftest/src/Obelisk/SelfTest.hs+5−8
lib/selftest/src/Obelisk/SelfTest.hs+5−8
@@ -12,7 +12,6 @@ import Control.Monad
1212import Control.Monad.IO.Class
1313import Data.Bool (bool)
1414import Data.Function (fix)
15−import Data.Semigroup (Semigroup, (<>))
1615import qualified Data.Set as Set
1716import Data.String
1817import Data.Text (Text)
@@ -49,13 +48,11 @@ data ObRunState
4948cp :: FilePath
5049cp = $(staticWhich "cp")
5150
51+gitUserConfig :: [Text]
52+gitUserConfig = ["-c", "user.name=Obelisk Selftest", "-c", "user.email=noreply@example.com" ]
53+
5254commit :: Text -> Sh ()
53−commit msg = void $ run "git"
54− [ "-c"
55− , "user.name=Obelisk Selftest"
56− , "-c"
57− , "user.email=noreply@example.com"
58− , "commit"
55+commit msg = void $ run "git" $ gitUserConfig <> [ "commit"
5956 , "--no-gpg-sign"
6057 , "--allow-empty"
6158 , "-m"
@@ -308,7 +305,7 @@ testThunkPack path' = withTempFile (T.unpack $ toTextIgnore path') "test-file" $
308305 liftIO $ T.hPutStrLn handle "test file" >> hClose handle
309306 ensureThunkPackFails "modified"
310307 -- Existing stashes
311− void $ git ["stash"]
308+ void $ git $ gitUserConfig <> [ "stash" ]
312309 ensureThunkPackFails "has stashes"
313310
314311-- | Blocks until a non-empty line is available