Skip to content

Commit

Permalink
CTest: Find the right file if the branch name has a /
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Jan 20, 2017
1 parent b3cb9da commit 57aa8d5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test.cmake
Expand Up @@ -62,7 +62,8 @@ string(REPLACE "ref: refs/heads/" "" git_branch "${git_branch}") # -> user/fooba
if(NOT git_branch MATCHES "^[0-9a-f]+$") # an actual branch name, not a hash
# read the associated hash
if(EXISTS "${CTEST_SOURCE_DIRECTORY}/.git/refs/heads/${git_branch}")
file(READ "${CTEST_SOURCE_DIRECTORY}/.git/refs/heads/${git_branch}" git_hash LIMIT 7)
set(git_hash_file "${CTEST_SOURCE_DIRECTORY}/.git/refs/heads/${git_branch}")
file(READ "${git_hash_file}" git_hash LIMIT 7)
string(STRIP "${git_hash}" git_hash)
endif()
string(REGEX REPLACE "^.*/" "" git_branch "${git_branch}")
Expand Down Expand Up @@ -285,8 +286,8 @@ if(NOT is_nightly)
# nightly builds shouldn't contain the git hash, since it makes expected builds impossible
string(STRIP "${git_hash} ${CTEST_BUILD_NAME}" CTEST_BUILD_NAME)
# instead make sure the hash is included in the notes
if(EXISTS "${CTEST_SOURCE_DIRECTORY}/.git/refs/heads/${git_branch}")
list(APPEND CTEST_NOTES_FILES "${CTEST_SOURCE_DIRECTORY}/.git/refs/heads/${git_branch}")
if(DEFINED git_hash_file)
list(APPEND CTEST_NOTES_FILES "${git_hash_file}")
endif()
endif()
if(DEFINED subset)
Expand Down

0 comments on commit 57aa8d5

Please sign in to comment.