diff --git a/src/drom_lib/genVersion.ml b/src/drom_lib/genVersion.ml index 1d149dac..cfd050f4 100644 --- a/src/drom_lib/genVersion.ml +++ b/src/drom_lib/genVersion.ml @@ -23,8 +23,13 @@ let query cmd = else None with End_of_file -> None -let commit_hash = query "git show -s --pretty=format:%%H" -let commit_date = query "git show -s --pretty=format:%%ci" +let gitdir = + try Sys.getenv "DUNE_SOURCEROOT" with Not_found -> "" + +let commit_hash = + query ("git -C \""^gitdir^"\" show -s --pretty=format:%%H") +let commit_date = + query ("git -C \""^gitdir^"\" show -s --pretty=format:%%ci") let version = %S let string_option = function