diff mbox series

scripts/yocto_testresults_query.py: ensure tag is fetched

Message ID 20230912210618.464769-1-alexandre.belloni@bootlin.com
State New
Headers show
Series scripts/yocto_testresults_query.py: ensure tag is fetched | expand

Commit Message

Alexandre Belloni Sept. 12, 2023, 9:06 p.m. UTC
From: Alexandre Belloni <alexandre.belloni@bootlin.com>

Ensure we fetch the tag before listing the first commit.

[ YOCTO #15193 ]

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 scripts/yocto_testresults_query.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/yocto_testresults_query.py b/scripts/yocto_testresults_query.py
index a5073736aab5..cc591177bb2a 100755
--- a/scripts/yocto_testresults_query.py
+++ b/scripts/yocto_testresults_query.py
@@ -31,7 +31,8 @@  def create_workdir():
 
 def get_sha1(pokydir, revision):
     try:
-        rev = subprocess.check_output(["git", "rev-list", "-n", "1", revision], cwd=pokydir).decode('utf-8').strip()
+        subprocess.check_call(["git", "fetch", "--depth", "1", "origin", revision], cwd=pokydir)
+        rev = subprocess.check_output(["git", "rev-list", "-n", "1", "FETCH_HEAD"], cwd=pokydir).decode('utf-8').strip()
         logger.info(f"SHA-1 revision for {revision} in {pokydir} is {rev}")
         return rev
     except subprocess.CalledProcessError: