Skip to content

Commit

Permalink
AutoRevision: Pick the latest tag in branch, not overall
Browse files Browse the repository at this point in the history
AutoRevision.cmake was using the latest tag created by git, which is
problematic when running two branches in parallel. Always use the latest tag in
the current branch instead.

(cherry picked from commit 6e41925)
  • Loading branch information
lmoureaux committed Mar 4, 2023
1 parent bc4bad9 commit f2f268a
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions cmake/AutoRevision.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-License-Identifier: GPLv3-or-later
# SPDX-FileCopyrightText: James Robertson <[email protected]>
# SPDX-FileCopyrightText: Louis Moureaux <[email protected]>

# This file runs a collection of git commands to help automate the process
# of generating the build revision. It takes an update to 3 files by hand
# to do it manually and automates it.
Expand Down Expand Up @@ -30,28 +34,10 @@ if (ok)
endif()
endif()

if (ok)
# Get a temp value of the full commit hash of the latest tag that is active
execute_process(
COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_SOURCE_DIR}/.git rev-list --tags --max-count=1
OUTPUT_VARIABLE hash
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE STATUS
ERROR_QUIET)

if (STATUS EQUAL 0)
message(STATUS "Last tag commit hash: ${hash}")
else()
# Can't use git
message(STATUS "Could not find a git tag")
set(ok false)
endif()
endif()

if (ok)
# Use the temp value to get the latest revision tag
execute_process(
COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_SOURCE_DIR}/.git describe --tags ${hash}
COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_SOURCE_DIR}/.git describe --tags --abbrev=0
OUTPUT_VARIABLE FC21_REV_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE STATUS
Expand Down

0 comments on commit f2f268a

Please sign in to comment.