{-# LANGUAGE TemplateHaskell #-}
module Agda.VersionCommit where
import Development.GitRev
import Agda.Version
versionWithCommitInfo :: String
versionWithCommitInfo :: String
versionWithCommitInfo = String
version String -> String -> String
forall a. [a] -> [a] -> [a]
++ case Maybe String
commitInfo of
Maybe String
Nothing -> String
""
Just String
info -> String
"-" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
info
commitInfo :: Maybe String
commitInfo :: Maybe String
commitInfo
| String
hash String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"UNKNOWN" = Maybe String
forall a. Maybe a
Nothing
| Bool
otherwise = String -> Maybe String
forall a. a -> Maybe a
Just (String -> Maybe String) -> String -> Maybe String
forall a b. (a -> b) -> a -> b
$ String -> String
forall a. [a] -> [a]
abbrev String
hash String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
dirty
where
hash :: String
hash = $(String
gitHash)
dirty :: String
dirty | $(Bool
gitDirtyTracked) = String
"-dirty"
| Bool
otherwise = String
""
abbrev :: [a] -> [a]
abbrev = Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
take Int
7