Project

General

Profile

Bug #43895 » git_search_fix.patch

Tony Davies, 01/30/2020 09:50 AM

View differences:

cmake/modules/GetGitRevisionDescription.cmake 2020-01-09 05:36:54.000000000 +1100 → cmake/modules/GetGitRevisionDescription.cmake 2020-01-30 16:50:35.633034303 +1100
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
set(TOP_LEVEL_DIR "${CMAKE_SOURCE_DIR}")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
if(GIT_PARENT_DIR STREQUAL TOP_LEVEL_DIR)
# We have reached the top of the source tree, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
    (1-1/1)