| @@ -1,8 +1,10 @@ | |||||
| # Execute git command and return the output | # Execute git command and return the output | ||||
| Function ( GitExecute COMMAND FORCE OUT_RESULT OUT_SUCCESS ) | |||||
| Function ( GitExecute GIT_ROOT COMMAND FORCE OUT_RESULT OUT_SUCCESS ) | |||||
| Set ( ${OUT_SUCCESS} 1 PARENT_SCOPE ) | Set ( ${OUT_SUCCESS} 1 PARENT_SCOPE ) | ||||
| Execute_Process ( COMMAND | Execute_Process ( COMMAND | ||||
| bash -c "${COMMAND}" | bash -c "${COMMAND}" | ||||
| WORKING_DIRECTORY | |||||
| "${GIT_ROOT}" | |||||
| RESULT_VARIABLE | RESULT_VARIABLE | ||||
| GIT_RET | GIT_RET | ||||
| OUTPUT_VARIABLE | OUTPUT_VARIABLE | ||||
| @@ -28,17 +30,17 @@ Function ( GitGetVersion GIT_ROOT OUT_MAJOR OUT_MINOR OUT_PATCH OUT_BUILD OUT_HA | |||||
| EndIf ( ) | EndIf ( ) | ||||
| # Find the latest git tag | # Find the latest git tag | ||||
| GitExecute ( "git -C ${GIT_ROOT} describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS ) | |||||
| GitExecute ( "${GIT_ROOT}" "git describe --tags --abbrev=1 --match v[0-9].[0-9]* HEAD" False TAG SUCCESS ) | |||||
| If ( NOT ${SUCCESS} ) | If ( NOT ${SUCCESS} ) | ||||
| Return ( ) | Return ( ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| GitExecute ( "git -C ${GIT_ROOT} status -s -uall" True DIRTY SUCCESS ) | |||||
| GitExecute ( "${GIT_ROOT}" "git status -s -uall" True DIRTY SUCCESS ) | |||||
| If ( NOT ${SUCCESS} ) | If ( NOT ${SUCCESS} ) | ||||
| Return ( ) | Return ( ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| GitExecute ( "git -C ${GIT_ROOT} rev-parse HEAD" True HASH SUCCESS ) | |||||
| GitExecute ( "${GIT_ROOT}" "git rev-parse HEAD" True HASH SUCCESS ) | |||||
| If ( NOT ${SUCCESS} ) | If ( NOT ${SUCCESS} ) | ||||
| Return ( ) | Return ( ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| @@ -108,7 +110,7 @@ Function ( GitGetHash GIT_ROOT OUT_HASH ) | |||||
| Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) | Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| GitExecute ( "git -C ${GIT_ROOT} rev-parse HEAD" True HASH SUCCESS ) | |||||
| GitExecute ( "${GIT_ROOT}" "git rev-parse HEAD" True HASH SUCCESS ) | |||||
| If ( NOT ${SUCCESS} ) | If ( NOT ${SUCCESS} ) | ||||
| Return ( ) | Return ( ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| @@ -126,7 +128,7 @@ Function ( GitGetIsDirty GIT_ROOT OUT_DIRTY ) | |||||
| Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) | Message ( FATAL_ERROR "${GIT_ROOT} is not a git directory" ) | ||||
| EndIf ( ) | EndIf ( ) | ||||
| GitExecute ( "git -C ${GIT_ROOT} status -s -uall" True DIRTY SUCCESS ) | |||||
| GitExecute ( "${GIT_ROOT}" "git status -s -uall" True DIRTY SUCCESS ) | |||||
| If ( NOT ${SUCCESS} ) | If ( NOT ${SUCCESS} ) | ||||
| Return ( ) | Return ( ) | ||||
| EndIf ( ) | EndIf ( ) | ||||