From a5d71af83a01b3608ad8c1a4c2e1a4ad585ece97 Mon Sep 17 00:00:00 2001 From: "Adrien M. BERNEDE" Date: Mon, 27 Feb 2023 11:27:23 +0100 Subject: [PATCH] Attempt at getting the commit with a fetch --- lib/spack/spack/version.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py index 2048e794cc1..84a5183358a 100644 --- a/lib/spack/spack/version.py +++ b/lib/spack/spack/version.py @@ -1336,6 +1336,10 @@ def lookup_ref(self, ref): # won't properly update the local rev-list) self.fetcher.git("fetch", "--tags", output=os.devnull, error=os.devnull) + # We need to do an attempt at fetching the commit in order to + # be sure to get it in case it comes from a PR in a fork. + self.fetcher.git("fetch", "%s^{commit}" % ref, output=os.devnull, error=os.devnull) + # Ensure ref is a commit object known to git # Note the brackets are literals, the ref replaces the format string try: