aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorJulian Stecklina <julian.stecklina@cyberus-technology.de>2020-03-02 14:42:19 +0100
committerJulian Stecklina <js@alien8.de>2020-03-29 22:29:57 +0200
commitc8d33de77781fe7850d04a7374c6c22a2e995b70 (patch)
tree6838e7513a9375df1bfd7ea93da174dcba91ccfe /src/libexpr/primops
parentea861be292d790db9835c08abee734baa77b9cf7 (diff)
Add git submodule fixes from @bjornfor
This fixes fetching repositories with no submodules and also cleans up .git files in checkouts.
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchGit.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index b08e48404..c58d28bbc 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -6,6 +6,7 @@
#include "hash.hh"
#include "tarfile.hh"
+#include <filesystem>
#include <sys/time.h>
#include <regex>
@@ -182,9 +183,13 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
runProgram("git", true, { "-C", tmpDir, "checkout", "--quiet", "FETCH_HEAD" });
runProgram("git", true, { "-C", tmpDir, "remote", "add", "origin", uri });
- runProgram("git", true, { "-C", tmpDir, "submodule", "--quiet", "update", "--init" });
+ runProgram("git", true, { "-C", tmpDir, "submodule", "--quiet", "update", "--init", "--recursive" });
- deletePath(tmpDir + "/.git");
+ for (const auto& p : std::filesystem::recursive_directory_iterator(tmpDir)) {
+ if (p.path().filename() == ".git") {
+ std::filesystem::remove_all(p.path());
+ }
+ }
gitInfo.submodules = true;
} else {