git.iko.soy/typeable/gitrev
on master help sign in
add commit date of the current HEAD

see: https://github.com/commercialhaskell/stack/issues/792#issuecomment-132201702

commit6a7018a26121ecf5657e40d48c4165d477b6e145 authorMaciej Kazulak <kazulakm@gmail.com> dateSun 27 Sep 2015, 13:31 (11 years ago) parent8184c27
2 files changed+7−1
Example.hs+1 src/Development/GitRev.hs+6−1
Example.hs+1
@@ -6,6 +6,7 @@ panic :: String -> a
66panic msg = error panicMsg
77 where panicMsg =
88 concat [ "[panic ", $(gitBranch), "@", $(gitHash)
9+ , " (", $(gitCommitDate), ")"
910 , " (", $(gitCommitCount), " commits in HEAD)"
1011 , dirty, "] ", msg ]
1112 dirty | $(gitDirty) = " (uncommitted files present)"
src/Development/GitRev.hs+6−1
@@ -28,7 +28,7 @@
2828-- > % cabal exec runhaskell Example.hs
2929-- > Example.hs: [panic master@2702e69355c978805064543489c351b61ac6760b (6 commits in HEAD) (uncommitted files present)] oh no!
3030
31−module Development.GitRev (gitHash, gitBranch, gitDirty, gitCommitCount) where
31+module Development.GitRev (gitHash, gitBranch, gitDirty, gitCommitCount, gitCommitDate) where
3232
3333import Control.Applicative
3434import Control.Exception
@@ -110,3 +110,8 @@ gitDirty = do
110110gitCommitCount :: ExpQ
111111gitCommitCount =
112112 stringE =<< runGit ["rev-list", "HEAD", "--count"] "UNKNOWN"
113+
114+-- | Return the commit date of the current head
115+gitCommitDate :: ExpQ
116+gitCommitDate =
117+ stringE =<< runGit ["log", "HEAD", "-1", "--format=%cd"] "UNKNOWN"