From 852e651efe2a9f6ebd07841e377e566fae92ac21 Mon Sep 17 00:00:00 2001 From: Anderson Date: Tue, 16 Jan 2024 14:47:56 -0700 Subject: [PATCH] Updated to use cmake string(REGEX REPLACE) when converting git log output (#597) In the off chance that Git decides to change the output of git log -1 "--pretty=format:%p", use a regex match and replace in cmake to match consecutive spaces and replace them with a single ;. --- .../mockprogram_inout.single_repo_two_parents_version.txt | 2 +- tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/ExamplesUnitTests/configure_git_mockprogram_files/mockprogram_inout.single_repo_two_parents_version.txt b/test/core/ExamplesUnitTests/configure_git_mockprogram_files/mockprogram_inout.single_repo_two_parents_version.txt index fa4bb6a5e..f192681d6 100644 --- a/test/core/ExamplesUnitTests/configure_git_mockprogram_files/mockprogram_inout.single_repo_two_parents_version.txt +++ b/test/core/ExamplesUnitTests/configure_git_mockprogram_files/mockprogram_inout.single_repo_two_parents_version.txt @@ -6,7 +6,7 @@ MOCK_PROGRAM_RETURN: 0 MOCK_PROGRAM_OUTPUT: This is the HEAD commit summary line MOCK_PROGRAM_INPUT: log -1 --pretty=format:%p HEAD MOCK_PROGRAM_RETURN: 0 -MOCK_PROGRAM_OUTPUT: b5678aop c9101hah +MOCK_PROGRAM_OUTPUT: b5678aop c9101hah MOCK_PROGRAM_INPUT: log -1 --pretty=format:%h [%ad] <%ae> b5678aop MOCK_PROGRAM_RETURN: 0 MOCK_PROGRAM_OUTPUT: b5678aop [Thu Sep 20 19:19:18 2023 -0400] diff --git a/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake b/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake index 6f187887e..32d6ac9d3 100644 --- a/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake +++ b/tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake @@ -202,7 +202,7 @@ function(tribits_generate_single_repo_version_string gitRepoDir " with output '${gitCmndOutput}' for sha1 ${gitHeadSha1} of repo ${gitRepoDir}!") set(headParentList "Error, could not get commit's parents!") else() - string(REPLACE " " ";" headParentList "${gitCmndOutput}") + string(REGEX REPLACE " +" ";" headParentList "${gitCmndOutput}") endif() list(LENGTH headParentList headNumParents)