Skip to content

Commit

Permalink
fetchClosure: Refactor: rename toCA -> enableRewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Jun 30, 2023
1 parent 0f6d596 commit 7e5b6d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libexpr/primops/fetchClosure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg

std::optional<std::string> fromStoreUrl;
std::optional<StorePath> fromPath;
bool toCA = false;
bool enableRewriting = false;
std::optional<StorePath> toPath;

for (auto & attr : *args[0]->attrs) {
Expand All @@ -27,7 +27,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg

else if (attrName == "toPath") {
state.forceValue(*attr.value, attr.pos);
toCA = true;
enableRewriting = true;
if (attr.value->type() != nString || attr.value->string.s != std::string("")) {
NixStringContext context;
toPath = state.coerceToStorePath(attr.pos, *attr.value, context, attrHint());
Expand Down Expand Up @@ -75,7 +75,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg

auto fromStore = openStore(parsedURL.to_string());

if (toCA) {
if (enableRewriting) {
if (!toPath || !state.store->isValidPath(*toPath)) {
auto remappings = makeContentAddressed(*fromStore, *state.store, { *fromPath });
auto i = remappings.find(*fromPath);
Expand Down

0 comments on commit 7e5b6d2

Please sign in to comment.