Skip to content
Snippets Groups Projects
Commit 388d8a7f authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

setup-poulpe-den: add support for cloning Git repositories

The war wages on ;)
parent 5dc622c6
No related branches found
No related tags found
1 merge request!40clone git too
......@@ -110,6 +110,8 @@
dest = repo_dir / dest
if repo_type == "hg":
return clone_hg(url, dest, suite_name)
if repo_type == "git":
return clone_git(url, dest, suite_name)
raise NotImplementedError(repo_type)
......@@ -113,6 +115,28 @@
raise NotImplementedError(repo_type)
def clone_git(source, dest, suite_name):
environ = os.environ.copy()
environ["GIT_CONFIG_GLOBAL"] = "/dev/null"
environ["GIT_CONFIG_SYSTEM"] = "/dev/null"
# Git doesn't have shares, so directly look for the temp clone
TMP_CLONE_PATH = Path(f"/tmp/poulpe-clone-cache/{suite_name}/{dest}")
# Does it look like a clone? Don't bother to be more resistant for now
if Path(TMP_CLONE_PATH, ".git").is_dir():
source = TMP_CLONE_PATH
command = [
"git",
"clone",
"--quiet",
source,
dest,
]
subprocess.run(command, check=True, env=environ)
def clone_hg(source, dest, suite_name):
environ = os.environ.copy()
environ["HGRCPATH"] = ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment