gitrev-typed
Copyright(c) 2015 Adam C. Foltzer
LicenseBSD3
Maintaineracfoltzer@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

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

Documentation

gitBranch :: ExpQ Source #

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

Expand
λ. $(gitBranch)
"main"
>>> $(gitBranch)
...

gitCommitCount :: ExpQ Source #

Return the number of commits in the current head.

Examples

Expand
λ. $(gitCommitCount)
"47"
>>> $(gitCommitCount)
...

gitCommitDate :: ExpQ Source #

Return the commit date of the current head.

Examples

Expand
λ. $(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

Expand
λ. $(gitDescribe)
"e67e943"
>>> $(gitDescribe)
...

gitDiff :: ExpQ Source #

Return the diff of the working copy with HEAD.

Examples

Expand
λ. $(gitDiff)
diff ...
>>> $(gitDiff)
...

gitDirty :: ExpQ Source #

Return True if there are non-committed files present in the repository.

Examples

Expand
λ. $(gitDirty)
False
>>> $(gitDirty)
...

gitDirtyTracked :: ExpQ Source #

Return True if there are non-commited changes to tracked files present in the repository.

Examples

Expand
λ. $(gitDirtyTracked)
False
>>> $(gitDirtyTracked)
...

gitHash :: ExpQ Source #

Return the hash of the current git commit, or UNKNOWN if not in a git repository.

Examples

Expand
λ. $(gitHash)
"e67e943dd03744d3f93c21f84e127744e6a04543"
>>> $(gitHash)
...

gitShortHash :: ExpQ Source #

Return the short hash of the current git commit, or UNKNOWN if not in a git repository.

Examples

Expand
λ. $(gitShortHash)
"e67e943"
>>> $(gitShortHash)
...

gitTree :: ExpQ Source #

Return the hash of the current tree.

Examples

Expand
λ. $(gitTreeQ)
"Mon Apr 14 22:14:44 2025 +1200"
>>> $(gitTreeQ)
...