aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 7c0902978..2dad1f5f6 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -277,7 +277,7 @@ StorePath Store::addToStore(
Path srcPath(absPath(_srcPath));
auto source = sinkToSource([&](Sink & sink) {
if (method == FileIngestionMethod::Recursive)
- dumpPath(srcPath, sink, filter);
+ sink << dumpPath(srcPath, filter);
else
readFileSource(srcPath)->drainInto(sink);
});
@@ -425,13 +425,11 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
/* Functionally, this means that fileSource will yield the content of
srcPath. The fact that we use scratchpadSink as a temporary buffer here
is an implementation detail. */
- auto fileSource = sinkToSource([&](Sink & scratchpadSink) {
- dumpPath(srcPath, scratchpadSink);
- });
+ auto fileSource = GeneratorSource{dumpPath(srcPath)};
/* tapped provides the same data as fileSource, but we also write all the
information to narSink. */
- TeeSource tapped { *fileSource, narSink };
+ TeeSource tapped { fileSource, narSink };
ParseSink blank;
auto & parseSink = method == FileIngestionMethod::Flat
@@ -466,10 +464,8 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
info.narSize = narSize;
if (!isValidPath(info.path)) {
- auto source = sinkToSource([&](Sink & scratchpadSink) {
- dumpPath(srcPath, scratchpadSink);
- });
- addToStore(info, *source);
+ auto source = GeneratorSource{dumpPath(srcPath)};
+ addToStore(info, source);
}
return info;