test: simplify git clone command

In some (ununderstood) cases the combination of `--no-single-branch` and
`--depth=1` leads to the revision we want to check out not being
available.

Achilleas suggested to change the command to this instead.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
Simon de Vlieger 2025-05-22 12:36:53 +02:00 committed by Achilleas Koutsou
parent 87f7b62316
commit b5e4775b24

View file

@ -110,9 +110,19 @@ def checkout_images_repo(ref, workdir: os.PathLike) -> str:
print(f"Checking out '{OSBUILD_IMAGES_REPO_URL}' repository at ref '{ref}'")
try:
subprocess.check_call(
["git", "clone", "--depth=1", "--no-single-branch", OSBUILD_IMAGES_REPO_URL, "images"],
["git", "clone", OSBUILD_IMAGES_REPO_URL, "images"],
cwd=workdir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
)
subprocess.check_call(
["git", "fetch", "--all"],
cwd=images_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
)
subprocess.check_call(
["git", "checkout", ref],
cwd=images_path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError as e:
print(f"Failed to clone 'images' repository: {e.stdout.decode()}")
sys.exit(1)