diff options
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 98e4d7efe..757aa21e3 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1887,25 +1887,23 @@ ContentAddress LocalStore::hashCAPath( const std::string_view pathHash ) { - HashModuloSink caSink ( hashType, std::string(pathHash) ); - std::visit(overloaded { - [&](const TextIngestionMethod &) { - caSink << readFileSource(path); + auto data = std::visit(overloaded { + [&](const TextIngestionMethod &) -> GeneratorSource { + return GeneratorSource(readFileSource(path)); }, - [&](const FileIngestionMethod & m2) { + [&](const FileIngestionMethod & m2) -> GeneratorSource { switch (m2) { case FileIngestionMethod::Recursive: - caSink << dumpPath(path); - break; + return GeneratorSource(dumpPath(path)); case FileIngestionMethod::Flat: - caSink << readFileSource(path); - break; + return GeneratorSource(readFileSource(path)); } + assert(false); }, }, method.raw); return ContentAddress { .method = method, - .hash = caSink.finish().first, + .hash = computeHashModulo(hashType, std::string(pathHash), data).first, }; } |