fetchClosure: Skip makeContentAddressed() if toPath is already valid
This commit is contained in:
parent
5acaf13d35
commit
7ffda0af6e
1 changed files with 22 additions and 20 deletions
|
@ -54,6 +54,7 @@ static void prim_fetchClosure(EvalState & state, const Pos & pos, Value * * args
|
||||||
auto fromStore = openStore(*fromStoreUrl);
|
auto fromStore = openStore(*fromStoreUrl);
|
||||||
|
|
||||||
if (toCA) {
|
if (toCA) {
|
||||||
|
if (!toPath || !state.store->isValidPath(*toPath)) {
|
||||||
auto remappings = makeContentAddressed(*fromStore, *state.store, { *fromPath });
|
auto remappings = makeContentAddressed(*fromStore, *state.store, { *fromPath });
|
||||||
auto i = remappings.find(*fromPath);
|
auto i = remappings.find(*fromPath);
|
||||||
assert(i != remappings.end());
|
assert(i != remappings.end());
|
||||||
|
@ -74,6 +75,7 @@ static void prim_fetchClosure(EvalState & state, const Pos & pos, Value * * args
|
||||||
state.store->printStorePath(i->second)),
|
state.store->printStorePath(i->second)),
|
||||||
.errPos = pos
|
.errPos = pos
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
copyClosure(*fromStore, *state.store, RealisedPath::Set { *fromPath });
|
copyClosure(*fromStore, *state.store, RealisedPath::Set { *fromPath });
|
||||||
toPath = fromPath;
|
toPath = fromPath;
|
||||||
|
|
Loading…
Reference in a new issue