Skip to content

Commit

Permalink
Fix wrong base tag used for deployment and displayed in About dialog
Browse files Browse the repository at this point in the history
By default, `git describe` shows the number of commits from the latest
tag in the git history. In our case we don't want that, because this can
cause problems:
            2.4-alpha              Expected: 2.4-alpha-N-abcdef123
    main ---+X---------------+---> Actual: 2.3.0-M-abcdef456
             \              /
              X------------X--->
             2.3-beta     2.3.0

Hence, we need to add the `--first-parent` flag to git describe, so that
it only follows the first parent of a merge and does not pull in tags
from another branch.

Fixes mixxxdj/website#248.

See the issue for details: mixxxdj/website#248
  • Loading branch information
Holzhaus committed Jul 7, 2021
1 parent 57670a4 commit f3f4b59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/GitInfo.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Get the current commit ref
if(NOT GIT_DESCRIBE)
execute_process(
COMMAND git describe --tags --always --dirty=-modified
COMMAND git describe --tags --always --first-parent --dirty=-modified
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down
8 changes: 7 additions & 1 deletion tools/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ def git_info(info, path="."):
elif info == "describe":
# A dirty git state should only be possible on local builds, but since
# this script may be used locally we'll add it here.
cmd = ("git", "describe", "--always", "--dirty=-modified")
cmd = (
"git",
"describe",
"--always",
"--first-parent",
"--dirty=-modified",
)
else:
raise ValueError("Invalid git info type!")

Expand Down

0 comments on commit f3f4b59

Please sign in to comment.