From a40bd5e6ff0d378a7c2b2d9100b6668b2aae5541 Mon Sep 17 00:00:00 2001 From: Anderson Chauphan Date: Mon, 15 Jan 2024 21:27:43 -0700 Subject: [PATCH] Added global cmake cache var to show git commit parents (#597) Added global cmake cache variable `_SHOW_GIT_COMMIT_PARENTS:BOOL` that is default to OFF. This will be a project based variable to including parent commit info in the repo version output. --- .../core/package_arch/TribitsGlobalMacros.cmake | 8 ++++++++ .../doc/build_ref/TribitsBuildReferenceBody.rst | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake index 63149a375..e5c4d28a2 100644 --- a/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -685,6 +685,14 @@ macro(tribits_define_global_options_and_define_extra_repos) CACHE BOOL "Generate the ${PROJECT_NAME}RepoVersion.txt file.") + if ("${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT}" STREQUAL "") + set(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT OFF) + endif() + advanced_set(${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS + ${${PROJECT_NAME}_SHOW_GIT_COMMIT_PARENTS_DEFAULT} + CACHE BOOL + "Show parents' commit info in the repo version output.") + if ("${${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT}" STREQUAL "") set(${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES_DEFAULT OFF) endif() diff --git a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index 06600479e..92817594c 100644 --- a/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -2934,6 +2934,20 @@ NOTE: If the base ``.git/`` directory is missing, then no printed to cmake STDOUT. +Show parent(s) commit info in the repo version output +---------------------------------------------------- + +.. __SHOW_GIT_COMMIT_PARENTS: + +When working with local git repos for the project sources, one can include +the repo's head commit parent(s) info in the repo version output using:: + + -D _SHOW_GIT_COMMIT_PARENTS=ON + +For each parent commit, this will include their SHA1, author name, date, email +and its 80 character summary message in the repo version output string. + + Generating git version date files ---------------------------------