Skip to content

Commit

Permalink
Added global cmake cache var to show git commit parents (#597)
Browse files Browse the repository at this point in the history
Added global cmake cache variable `<PROJECT_NAME>_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.
  • Loading branch information
achauphan committed Jan 16, 2024
1 parent 3af75e3 commit a40bd5e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tribits/core/package_arch/TribitsGlobalMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 14 additions & 0 deletions tribits/doc/build_ref/TribitsBuildReferenceBody.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------------------------------

.. _<Project>_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 <Project>_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
---------------------------------

Expand Down

0 comments on commit a40bd5e

Please sign in to comment.