Skip to content

Commit

Permalink
Merge pull request #79 from jgollenz/main
Browse files Browse the repository at this point in the history
Handle initialized repo without commits
  • Loading branch information
rpavlik authored Jul 3, 2023
2 parents 14094b5 + 2f5c5f9 commit ff28f41
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GetGitRevisionDescription.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ if(HEAD_CONTENTS MATCHES "ref")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
if(EXISTS "@GIT_DIR@/packed-refs")
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
endif()
else()
Expand Down

0 comments on commit ff28f41

Please sign in to comment.