git.iko.soy/typeable/gitrev
on master help sign in
typeable/gitrev/README.md
23 lines 1.1 kB history raw
1[![Build Status](https://travis-ci.org/acfoltzer/gitrev.svg?branch=master)](https://travis-ci.org/acfoltzer/gitrev)
3Some handy Template Haskell splices for including the current git hash
4and branch in the code of your project. Useful for including in panic
5messages, `--version` output, or diagnostic info for more informative
6bug reports.
8Most of the complication in the `GitRev` module is due to the various
9places the current git hash might be stored:
111. Detached HEAD: the hash is in `.git/HEAD`
122. On a branch or tag: the hash is in a file pointed to by `.git/HEAD`
13in a location like `.git/refs/heads`
143. On a branch or tag but in a repository with packed refs: the hash
15is in `.git/packed-refs`
164. In any of the above situations, if the current repo is checked out
17as a submodule, follow the reference to its `.git` directory first
19These files are added as dependencies to modules that use `GitRev`, and
20so the module should be rebuilt automatically whenever these files
21change.
23If you run into further scenarios that cause problems, let me know!