Skip to content

Commit

Permalink
fetchGit: pipe
Browse files Browse the repository at this point in the history
Yes, I know this implementation is bad and I should feel bad, but
fetchGit OOMs when fetching certain repos on my build server with 32GB RAM.
  • Loading branch information
ajs124 committed Mar 4, 2019
1 parent 74e0587 commit e3e6c1a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/libexpr/primops/fetchGit.cc
Expand Up @@ -166,14 +166,11 @@ GitInfo exportGit(ref<Store> store, const std::string & uri,
if (e.errNo != ENOENT) throw;
}

// FIXME: should pipe this, or find some better way to extract a
// revision.
auto tar = runProgram("git", true, { "-C", cacheDir, "archive", gitInfo.rev });

Path tmpDir = createTempDir();
AutoDelete delTmpDir(tmpDir, true);

runProgram("tar", true, { "x", "-C", tmpDir }, tar);
auto bashCmds = std::string("git -C ") + cacheDir + " archive " + gitInfo.rev + " | tar x -C " + tmpDir;
runProgram("bash", true, {}, bashCmds);

gitInfo.storePath = store->addToStore(name, tmpDir);

Expand Down

0 comments on commit e3e6c1a

Please sign in to comment.