From 0fee107e79997ca670f1cd473ee01fef2fb2d325 Mon Sep 17 00:00:00 2001 From: Konrad Date: Tue, 27 Aug 2024 13:01:35 +0200 Subject: [PATCH] git_tag: make sure to search for last valid tage beginning with vx.y.z only --- CMakeLists.txt | 2 +- Tools/px4.py | 2 +- src/lib/version/px_update_git_header.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b63a44dfe9..54bf5e5cdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,7 @@ include(px4_parse_function_args) include(px4_git) execute_process( - COMMAND git describe --exclude ext/* --tags --match "v[0-9]*" + COMMAND git describe --exclude ext/* --match v[0-9]*.[0-9]*.[0-9]* --abbrev=0 --tags OUTPUT_VARIABLE PX4_GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE RESULTS_VARIABLE GIT_DESCRIBE_RESULT diff --git a/Tools/px4.py b/Tools/px4.py index 4136758873..530f07a8f1 100755 --- a/Tools/px4.py +++ b/Tools/px4.py @@ -65,7 +65,7 @@ def get_version(): if os.path.isdir(os.path.join(px4_dir, '.git')): # If inside a clone PX4 Firmware repository, get version from "git describe" - cmd = 'git describe --exclude ext/* --abbrev=0 --tags' + cmd = 'git describe --exclude ext/* --match v[0-9]*.[0-9]*.[0-9]* --abbrev=0 --tags' try: version = subprocess.check_output( cmd, cwd=px4_dir, shell=True).decode().strip() diff --git a/src/lib/version/px_update_git_header.py b/src/lib/version/px_update_git_header.py index bd1836fb03..1cbc3c0cef 100755 --- a/src/lib/version/px_update_git_header.py +++ b/src/lib/version/px_update_git_header.py @@ -40,7 +40,7 @@ header = """ if args.git_tag: git_tag = args.git_tag else: - git_describe_cmd = 'git describe --exclude ext/* --always --tags --dirty' + git_describe_cmd = 'git describe --exclude ext/* --match v[0-9]*.[0-9]*.[0-9]* --abbrev=0 --tags' git_tag = subprocess.check_output(git_describe_cmd.split(), stderr=subprocess.STDOUT).decode('utf-8').strip()