Skip to content

Commit 52f4c1c

Browse files
author
Nicholas Clarke
committed
Add 'git describe' command.
1 parent c5496f3 commit 52f4c1c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Development/GitRev.hs

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

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
3340

3441
import Control.Applicative
3542
import Control.Exception
@@ -103,6 +110,12 @@ gitBranch :: ExpQ
103110
gitBranch =
104111
stringE =<< runGit ["rev-parse", "--abbrev-ref", "HEAD"] "UNKNOWN" IdxNotUsed
105112

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

0 commit comments

Comments
 (0)