Merge branch 'bugfix/improve-git-describe-handling' into 'master'

build system: more accurate error information for git_describe

Closes IDFGH-7504

See merge request espressif/esp-idf!23891
pull/11524/head
Zim Kalinowski 2023-05-25 16:21:40 +08:00
commit c74c18520e
2 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -79,8 +79,7 @@ function(__project_get_revision var)
if(PROJECT_VER_GIT) if(PROJECT_VER_GIT)
set(PROJECT_VER ${PROJECT_VER_GIT}) set(PROJECT_VER ${PROJECT_VER_GIT})
else() else()
message(STATUS "Project is not inside a git repository, or git repository has no commits;" message(STATUS "Could not use 'git describe' to determine PROJECT_VER.")
" will not use 'git describe' to determine PROJECT_VER.")
set(PROJECT_VER 1) set(PROJECT_VER 1)
endif() endif()
endif() endif()

Wyświetl plik

@ -53,10 +53,13 @@ function(get_git_head_revision _refspecvar _hashvar _repo_dir)
res res
OUTPUT_VARIABLE OUTPUT_VARIABLE
GIT_DIR GIT_DIR
ERROR_QUIET ERROR_VARIABLE
error
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0) if(NOT res EQUAL 0)
string(STRIP "${error}" error)
message(STATUS "git rev-parse returned '${error}'")
return() return()
endif() endif()
@ -123,9 +126,12 @@ function(git_describe _var _repo_dir)
res res
OUTPUT_VARIABLE OUTPUT_VARIABLE
out out
ERROR_QUIET ERROR_VARIABLE
error
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0) if(NOT res EQUAL 0)
string(STRIP "${error}" error)
message(STATUS "git describe returned '${error}'")
set(out "${out}-${res}-NOTFOUND") set(out "${out}-${res}-NOTFOUND")
endif() endif()