From 4017daeae6e22067f687e7e0edb072e5f7808627 Mon Sep 17 00:00:00 2001
From: stuebinm
Date: Sat, 12 Feb 2022 17:14:24 +0100
Subject: don't fail compilation if git is unavailable

(instead, `walint --version` will now just say "unknown")
---
 src/Version.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Version.hs b/src/Version.hs
index 6679ae1..c0f7edf 100644
--- a/src/Version.hs
+++ b/src/Version.hs
@@ -6,10 +6,12 @@ module Version ( version ) where
 import           Control.Monad.Trans (liftIO)
 import qualified Language.Haskell.TH as TH
 import           System.Process      (readProcess)
+import GHC.IO (catchAny)
 
 version :: String
 version = "walint rc3 2021 (" <>
     $(do
-        hash <- liftIO $ readProcess "git" ["rev-parse", "HEAD"] ""
+        hash <- liftIO $ catchAny (readProcess "git" ["rev-parse", "HEAD"] "")
+                         (\_ -> pure "[unknown]")
         pure . TH.LitE . TH.StringL $ take 40 hash) ++
     ")"
-- 
cgit v1.2.3