Fix submodule check out
@@ -23,7 +23,12 @@ class Git(ContentProvider):
try:
cmd = ["git", "clone", "--recursive"]
if ref is None:
+ # check out of HEAD is performed after the clone is complete
cmd.extend(["--depth", "1"])
+ else:
+ # don't check out HEAD, the given ref will be checked out later
+ # this prevents HEAD's submodules to be cloned if ref doesn't have them
+ cmd.extend(["--no-checkout"])
cmd.extend([repo, output_dir])
for line in execute_cmd(cmd, capture=yield_output):
yield line
@@ -34,6 +39,11 @@ class Git(ContentProvider):
# check out the specific ref given by the user
if ref is not None:
+ # check out ref as it has not been done yet
+ for line in execute_cmd(
+ ["git", "checkout", ref], cwd=output_dir, capture=yield_output
+ ):
+ yield line
hash = check_ref(ref, output_dir)
if hash is None:
self.log.error(
