@@ -66,7 +66,8 @@ stages:
#
-# Prep stage, update repositories once
+# Prep stage, update repositories once.
+# Set the CI variable CI_CLEAN_REPOS=1 to refetch the respositories from scratch
#
update-repos:
extends: .setup
@@ -4,6 +4,7 @@
import sys
import os
+import shutil
import subprocess
import pathlib
@@ -35,9 +36,14 @@ if __name__ == "__main__":
for repo in repositories:
repodir = base_repodir / repo_shortname(repo)
+
+ if "CI_CLEAN_REPOS" in os.environ:
+ print("Cleaning %s..." % repo)
+ shutil.rmtree(repodir, ignore_errors=True)
+
if repodir.exists():
print("Updating %s..." % repo)
- subprocess.run(["git", "-C", repodir, "fetch"], check=True)
+ subprocess.run(["git", "-C", repodir, "-c", "gc.autoDetach=false", "fetch"], check=True)
else:
print("Cloning %s..." % repo)
subprocess.run(["git", "clone", "--bare", repo, repodir], check=True)