[PATCH] KVM Test: Utils - Handle git commit without tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index df26a77..a6da832 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 CmdError:
+        desc = "no tag found"
+
     logging.info("Commit hash for %s is %s (%s)" % (repository, h.strip(),
                                                     desc))
     return srcdir
-- 
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux