diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-10-29T19·45+0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-29T19·45+0100 |
commit | 056c3fbbfc3ef61b7a63548521bef153acfe2106 (patch) | |
tree | e9629e1d19d6f0a18f10133a0c5856054c2d7f34 /src | |
parent | f90a67e24d906bdb86c86b9d1c7e6307aeb6ff7c (diff) | |
parent | 49e272f6472360ba952aa4fa62cc8e61a1b4d6b7 (diff) |
Merge pull request #2494 from FPtje/fix-copy-from-old
copyStorePath: Fix hash errors when copying from older store
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/store-api.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 92e2685f7f66..dc54c735fdb1 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -588,15 +588,19 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore, uint64_t total = 0; - // FIXME -#if 0 if (!info->narHash) { + StringSink sink; + srcStore->narFromPath({storePath}, sink); auto info2 = make_ref<ValidPathInfo>(*info); info2->narHash = hashString(htSHA256, *sink.s); if (!info->narSize) info2->narSize = sink.s->size(); + if (info->ultimate) info2->ultimate = false; info = info2; + + StringSource source(*sink.s); + dstStore->addToStore(*info, source, repair, checkSigs); + return; } -#endif if (info->ultimate) { auto info2 = make_ref<ValidPathInfo>(*info); |