From 3b54d174806a0973e666567b055a4e1965efd0b9 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Tue, 10 Oct 2023 21:51:20 +0200 Subject: [PATCH] patching: accept a sha1 in BASE_GIT_TAG (as well as branch or tag) - just for convenience --- lib/tools/patching.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/tools/patching.py b/lib/tools/patching.py index 946a1ce0ad..f29be61b3c 100755 --- a/lib/tools/patching.py +++ b/lib/tools/patching.py @@ -276,7 +276,14 @@ if apply_patches: try: BASE_GIT_REVISION = git_repo.branches[BASE_GIT_TAG].commit.hexsha except IndexError: - raise Exception(f"BASE_GIT_TAG={BASE_GIT_TAG} is neither a tag nor a branch") + # not a branch either, try as a hexsha: + try: + # see if the sha1 exists in the repo + commit = git_repo.commit(BASE_GIT_TAG) + log.debug(f"Found commit '{commit}' for BASE_GIT_TAG={BASE_GIT_TAG}") + BASE_GIT_REVISION = BASE_GIT_TAG + except: + raise Exception(f"BASE_GIT_TAG={BASE_GIT_TAG} is neither a tag nor a branch nor a SHA1") log.debug(f"Found BASE_GIT_REVISION={BASE_GIT_REVISION} for BASE_GIT_TAG={BASE_GIT_TAG}")