diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-11-09 15:57:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 15:57:39 +0100 |
commit | 67179472dfe30c97af9a5aeed0190c0e765936cf (patch) | |
tree | 8062dace9a6fec19a6095a13fc844ff8601313e4 /src/libexpr | |
parent | 884ef336c4bf838d853056d8abb926a71786afa6 (diff) | |
parent | 0b005bc9d67b3f621bc78e5ecb2cd834172d5563 (diff) |
Merge pull request #5494 from tweag/balsoft/allow-references-in-addPath
Allow references in addPath
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index e4107dbe1..aaeafb931 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1862,12 +1862,12 @@ static void addPath( // be rewritten to the actual output). state.realiseContext(context); + StorePathSet refs; + if (state.store->isInStore(path)) { auto [storePath, subPath] = state.store->toStorePath(path); - auto info = state.store->queryPathInfo(storePath); - if (!info->references.empty()) - throw EvalError("store path '%s' is not allowed to have references", - state.store->printStorePath(storePath)); + // FIXME: we should scanForReferences on the path before adding it + refs = state.store->queryPathInfo(storePath)->references; path = state.store->toRealPath(storePath) + subPath; } @@ -1905,7 +1905,7 @@ static void addPath( if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) { dstPath = state.store->printStorePath(settings.readOnlyMode ? state.store->computeStorePathForPath(name, path, method, htSHA256, filter).first - : state.store->addToStore(name, path, method, htSHA256, filter, state.repair)); + : state.store->addToStore(name, path, method, htSHA256, filter, state.repair, refs)); if (expectedHash && expectedStorePath != state.store->parseStorePath(dstPath)) throw Error("store path mismatch in (possibly filtered) path added from '%s'", path); } else |