1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 16:56:15 +01:00

git_version: Return version from the source code if there's no matching tag

This commit is contained in:
Daniel Mach 2022-08-22 11:08:34 +02:00
parent ef8c00afbb
commit 8acad28cc0

View File

@ -72,8 +72,10 @@ def get_version(version):
# removing "~" because it is not an allowed character in git tags
# and also because the normalized form is (for example) 1.0.0b0
if version and git_tag != version.replace("~", ""):
msg = f"Git tag '{git_tag}' doesn't correspond with version '{version}' specified in the source code"
raise ValueError(msg)
# Git tag doesn't correspond with version specified in the source code.
# The most common reason is that forks do not have their tags in sync with upstream.
# In that case just return the version specified in the source code.
return version
result = git_tag
if git_hash: