]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Update git rev parsing in CMake 9634/head
authorDaniel Gryniewicz <dang@redhat.com>
Fri, 10 Jun 2016 18:22:31 +0000 (14:22 -0400)
committerDaniel Gryniewicz <dang@redhat.com>
Fri, 10 Jun 2016 18:22:31 +0000 (14:22 -0400)
Git now can have a history for a short branch in the logs, breaking the
rev parsing.  Update to a newer version that fixes this.

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
cmake/modules/GetGitRevisionDescription.cmake
cmake/modules/GetGitRevisionDescription.cmake.in

index c8d27f2e8ce494c96404086ce58982239916a44c..85eae1562fe2011e9800787819b21f30a8898eb4 100644 (file)
@@ -110,7 +110,7 @@ function(git_describe _var)
                ${hash}
                ${ARGN}
                WORKING_DIRECTORY
-               "${CMAKE_SOURCE_DIR}"
+               "${CMAKE_CURRENT_SOURCE_DIR}"
                RESULT_VARIABLE
                res
                OUTPUT_VARIABLE
index 6faa374a8d9e618769428179557a206893b5224b..6d8b708efe56a66852752a7a30ec5c16b51cdc9e 100644 (file)
@@ -23,9 +23,12 @@ if(HEAD_CONTENTS MATCHES "ref")
        string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
        if(EXISTS "@GIT_DIR@/${HEAD_REF}")
                configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
-       elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
-               configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
-               set(HEAD_HASH "${HEAD_REF}")
+       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}")
+               endif()
        endif()
 else()
        # detached HEAD