1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-07 05:38:43 +02:00

Fix detecting version from git in archives from GitHub

There seem to be a bug in how GitHub generates archives.
"Format:" and "$" characters get removed from the version string,
setting it to:

    version = "%(describe:tags=true)"
This commit is contained in:
2022-07-04 14:42:06 +02:00
parent 515db3dea0
commit 2aaefb7c79

View File

@@ -10,8 +10,9 @@ def get_git_archive_version():
# the `version` variable contents get substituted during `git archive`
# it requires adding this to .gitattributes: <path to this file> export-subst
version = "$Format:%(describe:tags=true)$"
if version.startswith("$"):
# version hasn't been substituted during `git archive`
if version.startswith(("$", "%")):
# "$": version hasn't been substituted during `git archive`
# "%": "Format:" and "$" characters get removed from the version string (a GitHub bug?)
return None
return version