aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-20 23:44:06 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-20 23:44:06 +0100
commit73c98405695837dd93448ed38c0eeb0b56060dfc (patch)
treed70046e4bfe08269282cfa5257fe62ab53386ea5
parentd068f9ffff3d2a98e6dde0834a250e4930d44778 (diff)
Restore subdir -> dir
Got this mixed up somewhere.
-rw-r--r--src/libexpr/common-eval-args.cc2
-rw-r--r--src/libexpr/flake/flakeref.cc18
-rw-r--r--src/libstore/fetchers/registry.cc2
-rw-r--r--src/nix/flake.cc4
4 files changed, 13 insertions, 13 deletions
diff --git a/src/libexpr/common-eval-args.cc b/src/libexpr/common-eval-args.cc
index 1fdd4e9ec..fc60954b4 100644
--- a/src/libexpr/common-eval-args.cc
+++ b/src/libexpr/common-eval-args.cc
@@ -45,7 +45,7 @@ MixEvalArgs::MixEvalArgs()
auto from = parseFlakeRef(ss[0], absPath("."));
auto to = parseFlakeRef(ss[1], absPath("."));
fetchers::Input::Attrs extraAttrs;
- if (to.subdir != "") extraAttrs["subdir"] = to.subdir;
+ if (to.subdir != "") extraAttrs["dir"] = to.subdir;
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
});
}
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index b61352749..e8a2abb5d 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -23,7 +23,7 @@ fetchers::Input::Attrs FlakeRef::toAttrs() const
{
auto attrs = input->toAttrs();
if (subdir != "")
- attrs.emplace("subdir", subdir);
+ attrs.emplace("dir", subdir);
return attrs;
}
@@ -41,7 +41,7 @@ bool FlakeRef::operator ==(const FlakeRef & other) const
FlakeRef FlakeRef::resolve(ref<Store> store) const
{
auto [input2, extraAttrs] = lookupInRegistries(store, input);
- return FlakeRef(input2, fetchers::maybeGetStrAttr(extraAttrs, "subdir").value_or(subdir));
+ return FlakeRef(input2, fetchers::maybeGetStrAttr(extraAttrs, "dir").value_or(subdir));
}
FlakeRef parseFlakeRef(
@@ -138,13 +138,13 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
auto fragment = percentDecode(std::string(match[3]));
if (subdir != "") {
- if (parsedURL.query.count("subdir"))
- throw Error("flake URL '%s' has an inconsistent 'subdir' parameter", url);
- parsedURL.query.insert_or_assign("subdir", subdir);
+ if (parsedURL.query.count("dir"))
+ throw Error("flake URL '%s' has an inconsistent 'dir' parameter", url);
+ parsedURL.query.insert_or_assign("dir", subdir);
}
return std::make_pair(
- FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
+ FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "dir").value_or("")),
fragment);
}
@@ -153,7 +153,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
std::string fragment;
std::swap(fragment, parsedURL.fragment);
return std::make_pair(
- FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "subdir").value_or("")),
+ FlakeRef(inputFromURL(parsedURL), get(parsedURL.query, "dir").value_or("")),
fragment);
}
}
@@ -171,10 +171,10 @@ std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
FlakeRef FlakeRef::fromAttrs(const fetchers::Input::Attrs & attrs)
{
auto attrs2(attrs);
- attrs2.erase("subdir");
+ attrs2.erase("dir");
return FlakeRef(
fetchers::inputFromAttrs(attrs2),
- fetchers::maybeGetStrAttr(attrs, "subdir").value_or(""));
+ fetchers::maybeGetStrAttr(attrs, "dir").value_or(""));
}
std::pair<fetchers::Tree, FlakeRef> FlakeRef::fetchTree(ref<Store> store) const
diff --git a/src/libstore/fetchers/registry.cc b/src/libstore/fetchers/registry.cc
index ebf326bcc..fad389d17 100644
--- a/src/libstore/fetchers/registry.cc
+++ b/src/libstore/fetchers/registry.cc
@@ -37,7 +37,7 @@ std::shared_ptr<Registry> Registry::read(
for (auto & i : json["flakes"]) {
auto toAttrs = jsonToAttrs(i["to"]);
Input::Attrs extraAttrs;
- auto j = toAttrs.find("subdir");
+ auto j = toAttrs.find("dir");
if (j != toAttrs.end()) {
extraAttrs.insert(*j);
toAttrs.erase(j);
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 42f5b2ce0..0887fb402 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -507,7 +507,7 @@ struct CmdFlakeAdd : MixEvalArgs, Command
auto fromRef = parseFlakeRef(fromUrl);
auto toRef = parseFlakeRef(toUrl);
fetchers::Input::Attrs extraAttrs;
- if (toRef.subdir != "") extraAttrs["subdir"] = toRef.subdir;
+ if (toRef.subdir != "") extraAttrs["dir"] = toRef.subdir;
auto userRegistry = fetchers::getUserRegistry();
userRegistry->remove(fromRef.input);
userRegistry->add(fromRef.input, toRef.input, extraAttrs);
@@ -558,7 +558,7 @@ struct CmdFlakePin : virtual Args, EvalCommand
userRegistry->remove(ref.input);
auto [tree, resolved] = ref.resolve(store).input->fetchTree(store);
fetchers::Input::Attrs extraAttrs;
- if (ref.subdir != "") extraAttrs["subdir"] = ref.subdir;
+ if (ref.subdir != "") extraAttrs["dir"] = ref.subdir;
userRegistry->add(ref.input, resolved, extraAttrs);
}
};