aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libfetchers/git.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc
index 8981476e1..9908db214 100644
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -639,6 +639,14 @@ struct GitInputScheme : InputScheme
} else
runProgram("git", true, { "-C", tmpDir, "config", "remote.origin.url", actualUrl });
+ /* As an optimisation, copy the modules directory of the
+ source repo if it exists. */
+ auto modulesPath = repoDir + "/" + gitDir + "/modules";
+ if (pathExists(modulesPath)) {
+ Activity act(*logger, lvlTalkative, actUnknown, fmt("copying submodules of '%s'", actualUrl));
+ runProgram("cp", true, { "-R", "--", modulesPath, tmpGitDir + "/modules" });
+ }
+
{
Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching submodules of '%s'", tmpDir));
runProgram("git", true, { "-C", tmpDir, "submodule", "--quiet", "update", "--init", "--recursive" });