From b43d1756e552d2af0c76365b59a27f085f0c1f66 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@mozilla.com>
Date: Thu, 27 Oct 2022 07:17:30 +0000
Subject: [PATCH] Bug 1797243 - dump commit information when fetching git
 archive r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D160197
---
 taskcluster/scripts/misc/fetch-content | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/taskcluster/scripts/misc/fetch-content b/taskcluster/scripts/misc/fetch-content
index 6ec02713c2edc..d18e0d0828223 100755
--- a/taskcluster/scripts/misc/fetch-content
+++ b/taskcluster/scripts/misc/fetch-content
@@ -16,6 +16,7 @@ import multiprocessing
 import os
 import pathlib
 import random
+import re
 import stat
 import subprocess
 import sys
@@ -572,6 +573,14 @@ def git_checkout_archive(
     if repo.startswith('https://github.com/'):
         if not include_dot_git and not _github_submodule_required(repo, commit):
             log("Using github archive service to speedup archive creation")
+            # Always log sha1 info, either from commit or resolved from repo.
+            if re.match(r"^[a-fA-F0-9]{40}$", commit):
+                revision = commit
+            else:
+                ref_output = subprocess.check_output(["git", "ls-remote", repo,
+                                                      'refs/heads/' + commit])
+                revision, _ = ref_output.decode().split(maxsplit=1)
+            log("Fetching revision {}".format(revision))
             return _git_checkout_github_archive(dest_path, repo, commit, prefix)
 
     with tempfile.TemporaryDirectory() as td:
-- 
GitLab