Skip to content

Commit

Permalink
Perform check for embedded git rev at run time
Browse files Browse the repository at this point in the history
Previously, it was performed at compile time, where it will always be false as
no rev has been embedded yet.
  • Loading branch information
amesgen committed Mar 15, 2024
1 parent 28b8fa6 commit 314f618
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cardano-git-rev/src/Cardano/Git/Rev.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ foreign import ccall "&_cardano_git_rev" c_gitrev :: CString
-- This must be a TH splice to ensure the git commit is captured at build time.
-- ie called as `$(gitRev)`.
gitRev :: Q Exp
gitRev
| gitRevEmbed /= zeroRev = textE gitRevEmbed
| otherwise =
textE =<< TH.runIO runGitRevParse
gitRev =
[| if
| gitRevEmbed /= zeroRev -> gitRevEmbed
| otherwise -> $(textE =<< TH.runIO runGitRevParse)
|]

-- Git revision embedded after compilation using
-- Data.FileEmbed.injectWith. If nothing has been injected,
Expand Down

0 comments on commit 314f618

Please sign in to comment.