{-# OPTIONS_GHC -Wunused-imports #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
module Agda.VersionCommit where
#ifdef VERSION_WITH_GIT_HASH
import Development.GitRev
#endif
import Agda.Version
versionWithCommitInfo :: String
versionWithCommitInfo :: [Char]
versionWithCommitInfo = [Char]
version [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char] -> ([Char] -> [Char]) -> Maybe [Char] -> [Char]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [Char]
"" ([Char]
"-" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++) Maybe [Char]
commitInfo
commitInfo :: Maybe String
#ifdef VERSION_WITH_GIT_HASH
commitInfo
| hash == "UNKNOWN" = Nothing
| otherwise = Just $ abbrev hash ++ dirty
where
hash = $(gitHash)
dirty | $(gitDirtyTracked) = "-dirty"
| otherwise = ""
abbrev = take 7
#else
commitInfo :: Maybe [Char]
commitInfo = Maybe [Char]
forall a. Maybe a
Nothing
#endif