1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 14:53:16 +02:00

Add InputAccessor::fetchToStore()

This commit is contained in:
Eelco Dolstra 2022-08-11 20:03:22 +02:00
parent c0d33087c8
commit 2e0d63caf6
6 changed files with 59 additions and 27 deletions

View file

@ -2257,13 +2257,7 @@ StorePath EvalState::copyPathToStore(PathSet & context, const SourcePath & path)
auto dstPath = i != srcToStore.end()
? i->second
: [&]() {
auto source = sinkToSource([&](Sink & sink) {
path.dumpPath(sink);
});
auto dstPath =
settings.readOnlyMode
? store->computeStorePathFromDump(*source, path.baseName()).first
: store->addToStoreFromDump(*source, path.baseName(), FileIngestionMethod::Recursive, htSHA256, repair);
auto dstPath = path.fetchToStore(store, path.baseName(), nullptr, repair);
allowPath(dstPath);
srcToStore.insert_or_assign(path, dstPath);
printMsg(lvlChatty, "copied source '%1%' -> '%2%'", path, store->printStorePath(dstPath));