Check the process exit code rather than output variable for git header creation

This commit is contained in:
Marek Roszko 2022-10-29 14:20:50 -04:00
parent 5e1561fc22
commit 9eb3174133
2 changed files with 9 additions and 10 deletions

View File

@ -10,7 +10,6 @@ win64_build:
image: registry.gitlab.com/kicad/kicad-ci/windows-build-image/win1809-msvc:latest
variables:
VCPKG_BINARY_SOURCES: 'nuget,kicad,readwrite'
GIT_DEPTH: 0
cache:
key: win64-vcpkg-"$CI_COMMIT_REF_SLUG"
paths:

View File

@ -38,8 +38,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_DESCRIBE
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
ERROR_VARIABLE _git_describe_error
RESULT_VARIABLE _git_describe_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
@ -47,8 +47,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} rev-list --count --first-parent HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_REV_COUNT
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
ERROR_VARIABLE _git_rev_count_error
RESULT_VARIABLE _git_rev_count_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
@ -56,8 +56,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_REV_PARSE_HEAD
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
ERROR_VARIABLE _git_rev_parse_head_error
RESULT_VARIABLE _git_rev_parse_head_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
@ -65,15 +65,15 @@ macro( create_git_version_header _git_src_path )
# Check to make sure 'git' command did not fail. Otherwise fallback
# to KiCadVersion.cmake as the revision level.
if( _git_DESCRIBE )
if( _git_describe_result EQUAL 0 )
set( KICAD_VERSION "(${_git_DESCRIBE})" )
endif()
if( _git_DESCRIBE )
if( _git_rev_parse_head_result EQUAL 0 )
set( KICAD_COMMIT_HASH "${_git_REV_PARSE_HEAD}" )
endif()
if( _git_REV_COUNT )
if( _git_rev_count_result EQUAL 0 )
set( KICAD_GIT_REV "${_git_REV_COUNT}" )
# Sanity check