git.iko.soy/typeable/gitrev
on master help sign in
Merge branch 'describe' of https://github.com/nc6/gitrev into nc6-describe
f8c8130Adam C. Foltzer
src/Development/GitRev.hs+15−1
@@ -32,7 +32,15 @@
32-- > % cabal exec runhaskell Example.hs
32-- > % cabal exec runhaskell Example.hs
33-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
33-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
34
34
35−module Development.GitRev (gitHash, gitBranch, gitDirty, gitDirtyTracked, gitCommitCount, gitCommitDate) where
35+module Development.GitRev
36+ ( gitBranch
37+ , gitCommitCount
38+ , gitCommitDate
39+ , gitDescribe
40+ , gitDirty
41+ , gitDirtyTracked
42+ , gitHash
43+ ) where
36
44
37import Control.Exception
45import Control.Exception
38import Control.Monad
46import Control.Monad
@@ -137,6 +145,12 @@ gitBranch :: ExpQ
137gitBranch =
145gitBranch =
138 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
146 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
139
147
148+-- | Return the long git description for the current git commit, or
149+-- @UNKNOWN@ if not in a git repository.
150+gitDescribe :: ExpQ
151+gitDescribe =
152+ stringE =<< runGit ["describe", "--long", "--always"] "UNKNOWN" IdxNotUsed
153+
140-- | Return @True@ if there are non-committed files present in the
154-- | Return @True@ if there are non-committed files present in the
141-- repository
155-- repository
142gitDirty :: ExpQ
156gitDirty :: ExpQ