diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-01-20 20:45:34 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-01-20 20:57:44 +0000 |
commit | 5ee937523da63b26cc6dd264cc3cb2717321c5cd (patch) | |
tree | ecbdd43a9ce0284dd5409cc8a9603b66ccb5447a /src/libstore/store-api.cc | |
parent | a6ba313a0aac3b6e2fef434cb42d190a0849238e (diff) |
Add back `copyClosure` for plain `StorePath`s
This was removed in 2e199673a523fa81de31ffdd2a25976ce0814631 when
`copyPath` transitioned to use `RealisedPath`. But then in
e9848beca704d27a13e28b4403251725bd485bb2 we added it back just for
`realisedPath`.
I think it is a good utility function --- one can easily imagine it
becoming optimized in the future, and copying paths *violating* the
closure is a very niche feature.
So if we have `copyPaths` for both sorts of paths, I think we should
have `copyClosure` for both sorts too.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 970bafd88..bb9f0967d 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1042,6 +1042,21 @@ void copyClosure( copyPaths(srcStore, dstStore, closure, repair, checkSigs, substitute); } +void copyClosure( + Store & srcStore, + Store & dstStore, + const StorePathSet & storePaths, + RepairFlag repair, + CheckSigsFlag checkSigs, + SubstituteFlag substitute) +{ + if (&srcStore == &dstStore) return; + + StorePathSet closure; + srcStore.computeFSClosure(storePaths, closure); + copyPaths(srcStore, dstStore, closure, repair, checkSigs, substitute); +} + std::optional<ValidPathInfo> decodeValidPathInfo(const Store & store, std::istream & str, std::optional<HashResult> hashGiven) { std::string path; |