1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 18:29:36 +01:00

Merge pull request #14606 from NixOS/fix-copy-recursive

libutil: Fix copyRecursive and use for nix flake clone
This commit is contained in:
John Ericson 2025-11-20 22:28:45 +00:00 committed by GitHub
commit d3ff01cb2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -495,9 +495,9 @@ void InputScheme::clone(
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying '%s' to %s...", input2.to_string(), destDir)); Activity act(*logger, lvlTalkative, actUnknown, fmt("copying '%s' to %s...", input2.to_string(), destDir));
auto source = sinkToSource([&](Sink & sink) { accessor->dumpPath(CanonPath::root, sink); }); RestoreSink sink(/*startFsync=*/false);
sink.dstPath = destDir;
restorePath(destDir, *source); copyRecursive(*accessor, CanonPath::root, sink, CanonPath::root);
} }
std::optional<ExperimentalFeature> InputScheme::experimentalFeature() const std::optional<ExperimentalFeature> InputScheme::experimentalFeature() const

View file

@ -37,7 +37,6 @@ void copyRecursive(SourceAccessor & accessor, const CanonPath & from, FileSystem
sink.createDirectory(to, [&](FileSystemObjectSink & dirSink, const CanonPath & relDirPath) { sink.createDirectory(to, [&](FileSystemObjectSink & dirSink, const CanonPath & relDirPath) {
for (auto & [name, _] : accessor.readDirectory(from)) { for (auto & [name, _] : accessor.readDirectory(from)) {
copyRecursive(accessor, from / name, dirSink, relDirPath / name); copyRecursive(accessor, from / name, dirSink, relDirPath / name);
break;
} }
}); });
break; break;