Skip to content

Commit

Permalink
Merge pull request rpavlik#55 from malicious/worktree-support
Browse files Browse the repository at this point in the history
Add support for git-worktree when finding GIT_DIR
  • Loading branch information
rpavlik committed Dec 10, 2019
2 parents 74bb568 + e22a3e6 commit 8d8b489
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GetGitRevisionDescription.cmake
Expand Up @@ -66,6 +66,10 @@ function(get_git_head_revision _refspecvar _hashvar)
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
if(NOT IS_DIRECTORY "${GIT_DIR}")
file(READ ${GIT_DIR} worktree)
string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree})
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
Expand Down

0 comments on commit 8d8b489

Please sign in to comment.