From 8604d7e41e7135039f2d00f735023a094de57f68 Mon Sep 17 00:00:00 2001
From: Matt Borgerson <contact@mborgerson.com>
Date: Tue, 18 May 2021 03:46:50 -0700
Subject: [PATCH] build: Use commit hash if branch cannot be identified

---
 scripts/xemu-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/xemu-version.sh b/scripts/xemu-version.sh
index 953c77136c..b1e79addcf 100755
--- a/scripts/xemu-version.sh
+++ b/scripts/xemu-version.sh
@@ -14,7 +14,7 @@ XEMU_COMMIT=$( \
 XEMU_BRANCH=$( \
   cd "$dir"; \
   if test -e .git; then \
-    git symbolic-ref --short HEAD; \
+    git symbolic-ref --short HEAD || echo $XEMU_COMMIT; \
   elif test -e XEMU_BRANCH; then \
     cat XEMU_BRANCH; \
   fi)