Skip to content

Commit f8c8130

Browse files
author
Adam C. Foltzer
committed
Merge branch 'describe' of https://github.com/nc6/gitrev into nc6-describe
2 parents e1f2867 + 52f4c1c commit f8c8130

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Development/GitRev.hs

+15-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@
3232
-- > % cabal exec runhaskell Example.hs
3333
-- > Example.hs: [panic master@2ae047ba5e4a6f0f3e705a43615363ac006099c1 (Mon Jan 11 11:50:59 2016 -0800) (14 commits in HEAD) (uncommitted files present)] oh no!
3434

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
3644

3745
import Control.Exception
3846
import Control.Monad
@@ -137,6 +145,12 @@ gitBranch :: ExpQ
137145
gitBranch =
138146
stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
139147

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+
140154
-- | Return @True@ if there are non-committed files present in the
141155
-- repository
142156
gitDirty :: ExpQ

0 commit comments

Comments
 (0)