Skip to content

Commit

Permalink
Updated to use cmake string(REGEX REPLACE) when converting git log ou…
Browse files Browse the repository at this point in the history
…tput (#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 ;.
  • Loading branch information
achauphan committed Jan 16, 2024
1 parent e4b19b6 commit 852e651
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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] <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 852e651

Please sign in to comment.