File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change
1
+ Some handy Template Haskell splices for including the current git hash
2
+ and branch in the code of your project. Useful for including in panic
3
+ messages, ` --version ` output, or diagnostic info for more informative
4
+ bug reports.
5
+
6
+ Most of the complication in the ` GitRev ` module is due to the various
7
+ places the current git hash might be stored:
8
+
9
+ 1 . Detached HEAD: the hash is in ` .git/HEAD `
10
+ 2 . On a branch or tag: the hash is in a file pointed to by ` .git/HEAD `
11
+ in a location like ` .git/refs/heads `
12
+ 3 . On a branch or tag but in a repository with packed refs: the hash is
13
+ in ` .git/packed-refs `
14
+
15
+ These situations all arise under normal development workflows, but
16
+ there might be further scenarios that cause problems. Let me know if
17
+ you run into them!
You can’t perform that action at this time.
0 commit comments