diff --git a/src/dune b/src/dune index 3f5eb69bb8..494f0601fa 100644 --- a/src/dune +++ b/src/dune @@ -85,7 +85,7 @@ (target configVersion.ml) (mode (promote (until-clean) (only configVersion.ml))) ; replace existing file in source tree, even if releasing (only overrides) (deps (universe)) ; do not cache, always regenerate - (action (pipe-stdout (run git describe --all --long --dirty) (with-stdout-to %{target} (bash "xargs printf '(* Automatically regenerated, changes do not persist! *)\nlet version = \"%s\"'"))))) + (action (pipe-stdout (bash "git describe --all --long --dirty || echo \"n/a\"") (with-stdout-to %{target} (bash "xargs printf '(* Automatically regenerated, changes do not persist! *)\nlet version = \"%s\"'"))))) (rule (target configProfile.ml) diff --git a/src/version.ml b/src/version.ml index 3e6fce207f..cbe2874608 100644 --- a/src/version.ml +++ b/src/version.ml @@ -1,8 +1,16 @@ let release = "%%VERSION_NUM%%" +let release_commit = "%%VCS_COMMIT_ID%%" let goblint = let commit = ConfigVersion.version in if BatString.starts_with release "%" then commit - else + else ( + let commit = + if commit = "n/a" then (* released archive has no .git *) + release_commit + else + commit + in Format.sprintf "%s (%s)" release commit + )