summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2010-01-26 17:50:29 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2010-01-26 17:50:29 +0000
commit91806f5b222e3066d9268f3a39a141b046e5597e (patch)
tree3f9e53498986ce645a8d5a67a34aca7f5a3ca037
parent3419190da8b20d1f8c5c7827ea24e0c3f73fa2e9 (diff)
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 <lmr@redhat.com> git-svn-id: svn://test.kernel.org/autotest/trunk@4166 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/tests/kvm/kvm_utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index df26a772..f8089f71 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -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 error.CmdError:
+ desc = "no tag found"
+
logging.info("Commit hash for %s is %s (%s)" % (repository, h.strip(),
desc))
return srcdir