cfdc4822d4fe6abb79f6237f64957f463587fbaf

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

ci(deps): make git clone support non-branch refs (#13787)

Diff

 1diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py
 2index faab5a12c5044da22d3c0550868a867bcbb2115f..6fc93ad6e7433bcf1f02653d94fc5e558795bc37 100644
 3--- a/.github/workflows/dependencies/updater.py
 4+++ b/.github/workflows/dependencies/updater.py
 5@@ -348,7 +348,7 @@ class Git:
 6     default_branch = "master"
 7 
 8     @staticmethod
 9-    def clone(remote_url: str, branch: str, repo_dir: str, reclone=False):
10+    def clone(remote_url: str, ref: str, repo_dir: str, reclone=False):
11         # If repo needs to be fresh
12         if reclone and os.path.exists(repo_dir):
13             shutil.rmtree(repo_dir)
14@@ -356,11 +356,11 @@ class Git:
15         # Clone repo in tmp directory and checkout branch
16         if not os.path.exists(repo_dir):
17             print(
18-                f"Cloning {remote_url} to {repo_dir} and checking out {branch}",
19+                f"Cloning {remote_url} to {repo_dir} and checking out {ref}",
20                 file=sys.stderr,
21             )
22             CommandRunner.run_or_fail(
23-                ["git", "clone", "--depth=1", "-b", branch, remote_url, repo_dir],
24+                ["git", "clone", "--depth=1", "--revision", ref, remote_url, repo_dir],
25                 stage="Clone",
26             )
27