1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

Make sure references are empty for store path replacing

also copy info2 instead of casting
This commit is contained in:
Matthew Bauer 2020-06-17 14:14:22 -04:00
parent 8974755d19
commit be50de1142
3 changed files with 6 additions and 6 deletions

View file

@ -595,7 +595,7 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
uint64_t total = 0;
// recompute store path on the chance dstStore does it differently
if (info->isContentAddressed(*srcStore)) {
if (info->isContentAddressed(*srcStore) && info->references.empty()) {
auto info2 = make_ref<ValidPathInfo>(*info);
info2->path = dstStore->makeFixedOutputPathFromCA(info->path.name(), info->ca);
if (dstStore->storeDir == srcStore->storeDir)
@ -670,7 +670,7 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
auto info = srcStore->queryPathInfo(storePath);
auto storePathForDst = storePath;
if (info->isContentAddressed(*srcStore)) {
if (info->isContentAddressed(*srcStore) && info->references.empty()) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(storePath.name(), info->ca);
if (dstStore->storeDir == srcStore->storeDir)
assert(storePathForDst == storePath);
@ -697,7 +697,7 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
auto info = srcStore->queryPathInfo(storePath);
auto storePathForDst = storePath;
if (info->isContentAddressed(*srcStore)) {
if (info->isContentAddressed(*srcStore) && info->references.empty()) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(storePath.name(), info->ca);
if (dstStore->storeDir == srcStore->storeDir)
assert(storePathForDst == storePath);