From 2aaefb7c799adca1be7d8a2426752a3e6d549a88 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 4 Jul 2022 14:42:06 +0200 Subject: [PATCH] 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)" --- osc/util/git_version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osc/util/git_version.py b/osc/util/git_version.py index 92fc6948..5050939f 100644 --- a/osc/util/git_version.py +++ b/osc/util/git_version.py @@ -10,8 +10,9 @@ def get_git_archive_version(): # the `version` variable contents get substituted during `git archive` # it requires adding this to .gitattributes: 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