KVM Test: Utils - Handle git commit without tags
PATCH 1/1 KVM Test: Utils - Handle git commit without tags
Sometimes the latest commit might not have any tags associated, leading to a failure on git describe. Let's handle this failure appropriately.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>
--- client/tests/kvm/kvm_utils.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +5 -1
@@ -358,7 +358,11 @@ def get_git_branch(repository, branch, srcdir, commit=None, lbranch=None): utils.system("git checkout %s" % commit) h = utils.system_output('git log --pretty=format:"%H" -1') - desc = utils.system_output("git describe") + try: + desc = "tag %s" % utils.system_output("git describe") + except CmdError: + desc = "no tag found" + logging.info("Commit hash for %s is %s (%s)" % (repository, h.strip(), desc)) return srcdir
Signature · 1 line
1.6.6