]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Find Ccache version from lightweight Git tag
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 17 Apr 2023 16:08:24 +0000 (18:08 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 17 Apr 2023 16:14:56 +0000 (18:14 +0200)
Ccache calculates its version from a matching Git tag by using the "git
describe" command, which only considers annotated tags. All ccache tags
are annotated. However, when running a GitHub action job for a tag the
local Git repository is (at least by default) a shallow clone with the
tag being converted to a lightweight tag. This makes "git describe" not
see the tag.

Fix this by adding --tags to "git describe" to make it consider
lightweight tags as well.

Fixes #1270.

cmake/CcacheVersion.cmake

index 3d373bfaff95bfdc06c34b1e8ca5078d9e7744b6..34e7c965636a083450c46a6974ced90fe2d89a4e 100644 (file)
@@ -54,7 +54,7 @@ elseif(EXISTS "${CMAKE_SOURCE_DIR}/.git")
         ERROR_VARIABLE git_stderr ERROR_STRIP_TRAILING_WHITESPACE)
     endmacro()
 
-    git(describe --abbrev=8 --dirty)
+    git(describe --tags --abbrev=8 --dirty)
     if(git_stdout MATCHES "^v([^-]+)(-dirty)?$")
       set(CCACHE_VERSION "${CMAKE_MATCH_1}")
       if(NOT "${CMAKE_MATCH_2}" STREQUAL "")