Merge pull request #2494 from FPtje/fix-copy-from-old

copyStorePath: Fix hash errors when copying from older store
This commit is contained in:
Eelco Dolstra 2018-10-29 20:45:25 +01:00 committed by GitHub
commit 056c3fbbfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -588,15 +588,19 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
uint64_t total = 0; uint64_t total = 0;
// FIXME
#if 0
if (!info->narHash) { if (!info->narHash) {
StringSink sink;
srcStore->narFromPath({storePath}, sink);
auto info2 = make_ref<ValidPathInfo>(*info); auto info2 = make_ref<ValidPathInfo>(*info);
info2->narHash = hashString(htSHA256, *sink.s); info2->narHash = hashString(htSHA256, *sink.s);
if (!info->narSize) info2->narSize = sink.s->size(); if (!info->narSize) info2->narSize = sink.s->size();
if (info->ultimate) info2->ultimate = false;
info = info2; info = info2;
StringSource source(*sink.s);
dstStore->addToStore(*info, source, repair, checkSigs);
return;
} }
#endif
if (info->ultimate) { if (info->ultimate) {
auto info2 = make_ref<ValidPathInfo>(*info); auto info2 = make_ref<ValidPathInfo>(*info);