git.iko.soy/typeable/gitrev
on master help sign in
Add 'git describe' command.
52f4c1cNicholas Clarke
src/Development/GitRev.hs+14−1
@@ -29,7 +29,14 @@
29-- > % cabal exec runhaskell Example.hs
29-- > % cabal exec runhaskell Example.hs
30-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
30-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
31
31
32−module Development.GitRev (gitHash, gitBranch, gitDirty, gitCommitCount, gitCommitDate) where
32+module Development.GitRev
33+ ( gitBranch
34+ , gitCommitCount
35+ , gitCommitDate
36+ , gitDescribe
37+ , gitDirty
38+ , gitHash
39+ ) where
33
40
34import Control.Applicative
41import Control.Applicative
35import Control.Exception
42import Control.Exception
@@ -103,6 +110,12 @@ gitBranch :: ExpQ
103gitBranch =
110gitBranch =
104 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
111 stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
105
112
113+-- | Return the long git description for the current git commit, or @UNKNOWN@
114+-- it not in a git repository.
115+gitDescribe :: ExpQ
116+gitDescribe =
117+ stringE =<< runGit ["describe", "--long", "--always"] "UNKNOWN" IdxNotUsed
118+
106-- | Return @True@ if there are non-committed files present in the
119-- | Return @True@ if there are non-committed files present in the
107-- repository
120-- repository
108gitDirty :: ExpQ
121gitDirty :: ExpQ