Skip to content

Commit

Permalink
fix commit number handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vintagepc committed Sep 11, 2023
1 parent f1ab891 commit a185956
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmake/GetGitRevisionDescription.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,19 @@ function(git_describe_working_tree _var)
endif()
git_head_commit_number(COMMIT_COUNT) #Bake the commit count into the full DSC
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0 --dirty=-${COMMIT_COUNT}-D --broken=-B ${ARGN}
COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0 --dirty=-D --broken=-B ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()

if( "${out}" MATCHES "-D\$")
STRING(REPLACE "-D" "-${COMMIT_COUNT}-D" out "${out}")
else()
set(out "${out}-${COMMIT_COUNT}")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
Expand Down

0 comments on commit a185956

Please sign in to comment.