fetchToStore(): Handle flat ingestion method and add test

This commit is contained in:
Eelco Dolstra 2023-10-20 13:32:15 +02:00
parent 173abec0bc
commit 7a086a32bc
3 changed files with 20 additions and 9 deletions

View file

@ -14,7 +14,10 @@ StorePath InputAccessor::fetchToStore(
Activity act(*logger, lvlChatty, actUnknown, fmt("copying '%s' to the store", showPath(path))); Activity act(*logger, lvlChatty, actUnknown, fmt("copying '%s' to the store", showPath(path)));
auto source = sinkToSource([&](Sink & sink) { auto source = sinkToSource([&](Sink & sink) {
dumpPath(path, sink, filter ? *filter : defaultPathFilter); if (method == FileIngestionMethod::Recursive)
dumpPath(path, sink, filter ? *filter : defaultPathFilter);
else
sink(readFile(path)); // FIXME: stream
}); });
auto storePath = auto storePath =

View file

@ -1 +1 @@
"/nix/store/ya937r4ydw0l6kayq8jkyqaips9c75jm-output" [ "/nix/store/ya937r4ydw0l6kayq8jkyqaips9c75jm-output" "/nix/store/m7y372g6jb0g4hh1dzmj847rd356fhnz-output" ]

View file

@ -1,7 +1,15 @@
builtins.path [
{ path = ./.; (builtins.path
filter = path: _: baseNameOf path == "data"; { path = ./.;
recursive = true; filter = path: _: baseNameOf path == "data";
sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw"; recursive = true;
name = "output"; sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw";
} name = "output";
})
(builtins.path
{ path = ./data;
recursive = false;
sha256 = "0k4lwj58f2w5yh92ilrwy9917pycipbrdrr13vbb3yd02j09vfxm";
name = "output";
})
]