mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
Bugfix: Only use git for build info if the repository is actually the right one
Original-Github-Pull: #7522
This commit is contained in:
parent
8cb6ab0b97
commit
903fc971ed
1 changed files with 16 additions and 0 deletions
|
@ -40,6 +40,22 @@ if(NOT "$ENV{BITCOIN_GENBUILD_NO_GIT}" STREQUAL "1")
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(IS_INSIDE_WORK_TREE)
|
||||
# This check ensures that we are actually part of the intended git repository, and not just getting info about some unrelated git repository that the code happens to be in a directory under
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} status --porcelain -uall --ignored cmake/script/GenerateBuildInfo.cmake
|
||||
WORKING_DIRECTORY ${WORKING_DIR}
|
||||
RESULT_VARIABLE SCRIPT_STATUS_EXITCODE
|
||||
OUTPUT_VARIABLE SCRIPT_STATUS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(SCRIPT_STATUS_EXITCODE)
|
||||
set(IS_INSIDE_WORK_TREE 0)
|
||||
elseif(SCRIPT_STATUS MATCHES "^$|\\?")
|
||||
set(IS_INSIDE_WORK_TREE 0)
|
||||
endif()
|
||||
endif()
|
||||
if(IS_INSIDE_WORK_TREE)
|
||||
# Clean 'dirty' status of touched files that haven't been modified.
|
||||
execute_process(
|
||||
|
|
Loading…
Add table
Reference in a new issue