patching: accept a sha1 in BASE_GIT_TAG (as well as branch or tag)

- just for convenience
This commit is contained in:
Ricardo Pardini 2023-10-10 21:51:20 +02:00 committed by Igor
parent d6fca17014
commit 3b54d17480
1 changed files with 8 additions and 1 deletions

View File

@ -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}")