Skip to content

Commit

Permalink
Merge branch 'bugfix/improve-git-describe-handling-v5.1' into 'releas…
Browse files Browse the repository at this point in the history
…e/v5.1'

build system: more accurate error information for git_describe (v5.1)

See merge request espressif/esp-idf!24665
  • Loading branch information
Zim Kalinowski committed Jul 11, 2023
2 parents 8e2de1b + d636754 commit 819da74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tools/cmake/project.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ function(__project_get_revision var)
if(PROJECT_VER_GIT)
set(PROJECT_VER ${PROJECT_VER_GIT})
else()
message(STATUS "Project is not inside a git repository, or git repository has no commits;"
" will not use 'git describe' to determine PROJECT_VER.")
message(STATUS "Could not use 'git describe' to determine PROJECT_VER.")
set(PROJECT_VER 1)
endif()
endif()
Expand Down
10 changes: 8 additions & 2 deletions tools/cmake/third_party/GetGitRevisionDescription.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ function(get_git_head_revision _refspecvar _hashvar _repo_dir)
res
OUTPUT_VARIABLE
GIT_DIR
ERROR_QUIET
ERROR_VARIABLE
error
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(NOT res EQUAL 0)
string(STRIP "${error}" error)
message(STATUS "git rev-parse returned '${error}'")
return()
endif()

Expand Down Expand Up @@ -123,9 +126,12 @@ function(git_describe _var _repo_dir)
res
OUTPUT_VARIABLE
out
ERROR_QUIET
ERROR_VARIABLE
error
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
string(STRIP "${error}" error)
message(STATUS "git describe returned '${error}'")
set(out "${out}-${res}-NOTFOUND")
endif()

Expand Down

0 comments on commit 819da74

Please sign in to comment.