mirror of
https://github.com/rui314/mold.git
synced 2024-09-11 21:17:28 +03:00
Simplify
This commit is contained in:
parent
7f2a2c4233
commit
91378b9c2f
@ -8,13 +8,11 @@ if(EXISTS "${SOURCE_DIR}/.git/HEAD")
|
||||
set(HEAD "${CMAKE_MATCH_1}")
|
||||
if(EXISTS "${SOURCE_DIR}/.git/${HEAD}")
|
||||
file(READ "${SOURCE_DIR}/.git/${HEAD}" HASH)
|
||||
string(STRIP "${HASH}" HASH)
|
||||
else()
|
||||
file(STRINGS "${SOURCE_DIR}/.git/packed-refs" PACKED_REFS
|
||||
REGEX "${HEAD}$")
|
||||
list(GET PACKED_REFS 0 HEAD_REF)
|
||||
string(REGEX REPLACE "^(.*) ${HEAD}$" "\\1" HASH "${HEAD_REF}")
|
||||
file(READ "${SOURCE_DIR}/.git/packed-refs" PACKED_REFS)
|
||||
string(REGEX REPLACE ".*\n([0-9a-f]+) ${HEAD}\n.*" "\\1" HASH "\n${PACKED_REFS}")
|
||||
endif()
|
||||
string(STRIP "${HASH}" HASH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user