Skip to content

Commit

Permalink
Cleaned up git log and cmake command argument formatting (#597)
Browse files Browse the repository at this point in the history
Reordered git log arguments to the expected order as well as condensed
cmake command arguments into a single line.
  • Loading branch information
achauphan committed Jan 16, 2024
1 parent a40bd5e commit 592ea0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%H
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%h [%ad] <%ae>
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%h [%ad] <%ae> a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: a1234tgb [Thu Sep 21 19:19:18 2023 -0400] <[email protected]>
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%s
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: This is the HEAD commit summary line
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%p
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%p a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: b5678aop
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%H
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%h [%ad] <%ae>
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%h [%ad] <%ae> a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: a1234tgb [Thu Sep 21 19:19:18 2023 -0400] <[email protected]>
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%s
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: This is the HEAD commit summary line
MOCK_PROGRAM_INPUT: log -1 a1234tgbhyujkliu126sl12123s --pretty=format:%p
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%p a1234tgbhyujkliu126sl12123s
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: b5678aop c9101hah
MOCK_PROGRAM_INPUT: log -1 b5678aop --pretty=format:%h [%ad] <%ae>
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]>
MOCK_PROGRAM_INPUT: log -1 b5678aop --pretty=format:%s
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s b5678aop
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: This is parent 0 commit summary line
MOCK_PROGRAM_INPUT: log -1 c9101hah --pretty=format:%h [%ad] <%ae>
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%h [%ad] <%ae> c9101hah
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: c9101hah [Thu Sep 19 19:19:18 2023 -0400] <[email protected]>
MOCK_PROGRAM_INPUT: log -1 c9101hah --pretty=format:%s
MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s c9101hah
MOCK_PROGRAM_RETURN: 0
MOCK_PROGRAM_OUTPUT: This is parent 1 commit summary line








18 changes: 7 additions & 11 deletions tribits/core/package_arch/TribitsGitRepoVersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ function(tribits_git_repo_sha1 gitRepoDir gitRepoSha1Out)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 "--pretty=format:%H"
WORKING_DIRECTORY ${gitRepoDir}
RESULT_VARIABLE gitCmndRtn
OUTPUT_VARIABLE gitCmndOutput
RESULT_VARIABLE gitCmndRtn OUTPUT_VARIABLE gitCmndOutput
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
)

Expand Down Expand Up @@ -126,10 +125,9 @@ function(tribits_generate_commit_info_string gitRepoDir gitCommitSha1
# A) Get commit hash, author, date, and email

execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 ${gitCommitSha1} "--pretty=format:%h [%ad] <%ae>"
COMMAND ${GIT_EXECUTABLE} log -1 "--pretty=format:%h [%ad] <%ae>" ${gitCommitSha1}
WORKING_DIRECTORY ${gitRepoDir}
RESULT_VARIABLE gitCmndRtn
OUTPUT_VARIABLE gitCmndOutput
RESULT_VARIABLE gitCmndRtn OUTPUT_VARIABLE gitCmndOutput
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
)

Expand All @@ -144,10 +142,9 @@ function(tribits_generate_commit_info_string gitRepoDir gitCommitSha1
# B) Get the first 80 chars of the summary message for more info

execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 ${gitCommitSha1} "--pretty=format:%s"
COMMAND ${GIT_EXECUTABLE} log -1 "--pretty=format:%s" ${gitCommitSha1}
WORKING_DIRECTORY ${gitRepoDir}
RESULT_VARIABLE gitCmndRtn
OUTPUT_VARIABLE gitCmndOutput
RESULT_VARIABLE gitCmndRtn OUTPUT_VARIABLE gitCmndOutput
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
)

Expand Down Expand Up @@ -199,10 +196,9 @@ function(tribits_generate_single_repo_version_string gitRepoDir
# B) Get all of HEAD commit's parents into a list

execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 ${gitHeadSha1} "--pretty=format:%p"
COMMAND ${GIT_EXECUTABLE} log -1 "--pretty=format:%p" ${gitHeadSha1}
WORKING_DIRECTORY ${gitRepoDir}
RESULT_VARIABLE gitCmndRtn
OUTPUT_VARIABLE gitCmndOutput
RESULT_VARIABLE gitCmndRtn OUTPUT_VARIABLE gitCmndOutput
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE
)

Expand Down

0 comments on commit 592ea0d

Please sign in to comment.