Skip to content

Commit

Permalink
fetchToStore(): Handle flat ingestion method and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Oct 20, 2023
1 parent 173abec commit 7a086a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/libfetchers/input-accessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ StorePath InputAccessor::fetchToStore(
Activity act(*logger, lvlChatty, actUnknown, fmt("copying '%s' to the store", showPath(path)));

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 =
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/lang/eval-okay-path.exp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"/nix/store/ya937r4ydw0l6kayq8jkyqaips9c75jm-output"
[ "/nix/store/ya937r4ydw0l6kayq8jkyqaips9c75jm-output" "/nix/store/m7y372g6jb0g4hh1dzmj847rd356fhnz-output" ]
22 changes: 15 additions & 7 deletions tests/functional/lang/eval-okay-path.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
builtins.path
{ path = ./.;
filter = path: _: baseNameOf path == "data";
recursive = true;
sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw";
name = "output";
}
[
(builtins.path
{ path = ./.;
filter = path: _: baseNameOf path == "data";
recursive = true;
sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw";
name = "output";
})
(builtins.path
{ path = ./data;
recursive = false;
sha256 = "0k4lwj58f2w5yh92ilrwy9917pycipbrdrr13vbb3yd02j09vfxm";
name = "output";
})
]

0 comments on commit 7a086a3

Please sign in to comment.