Copyright | (c) 2015 Adam C. Foltzer |
---|---|
License | BSD3 |
Maintainer | acfoltzer@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Development.GitRev
Description
Some handy Template Haskell splices for including the current git
hash and branch in the code of your project. Useful for including
in panic messages, --version
output, or diagnostic info for more
informative bug reports.
Synopsis
- gitBranch :: ExpQ
- gitCommitCount :: ExpQ
- gitCommitDate :: ExpQ
- gitDescribe :: ExpQ
- gitDiff :: ExpQ
- gitDirty :: ExpQ
- gitDirtyTracked :: ExpQ
- gitHash :: ExpQ
- gitShortHash :: ExpQ
- gitTree :: ExpQ
Documentation
Return the branch (or tag) name of the current git commit, or UNKNOWN
if not in a git repository. For detached heads, this will just be
HEAD.
Examples
λ. $(gitBranch) "main"
>>>
$(gitBranch)
...
gitCommitCount :: ExpQ Source #
Return the number of commits in the current head.
Examples
λ. $(gitCommitCount) "47"
>>>
$(gitCommitCount)
...
gitCommitDate :: ExpQ Source #
Return the commit date of the current head.
Examples
λ. $(gitCommitDate) "Mon Apr 14 22:14:44 2025 +1200"
>>>
$(gitCommitDate)
...
gitDescribe :: ExpQ Source #
Return the long git description for the current git commit, or
UNKNOWN
if not in a git repository.
Examples
λ. $(gitDescribe) "e67e943"
>>>
$(gitDescribe)
...
Return the diff of the working copy with HEAD.
Examples
λ. $(gitDiff) diff ...
>>>
$(gitDiff)
...
Return True
if there are non-committed files present in the
repository.
Examples
λ. $(gitDirty) False
>>>
$(gitDirty)
...
gitDirtyTracked :: ExpQ Source #
Return True
if there are non-commited changes to tracked files
present in the repository.
Examples
λ. $(gitDirtyTracked) False
>>>
$(gitDirtyTracked)
...
Return the hash of the current git commit, or UNKNOWN
if not in
a git repository.
Examples
λ. $(gitHash) "e67e943dd03744d3f93c21f84e127744e6a04543"
>>>
$(gitHash)
...
gitShortHash :: ExpQ Source #
Return the short hash of the current git commit, or UNKNOWN
if not in
a git repository.
Examples
λ. $(gitShortHash) "e67e943"
>>>
$(gitShortHash)
...