1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

fetchGit/fetchTree: Improve exportIgnore, submodule interaction

Also fingerprint and some preparatory improvements.

Testing is still not up to scratch because lots of logic is duplicated
between the workdir and commit cases.
This commit is contained in:
Robert Hensing 2023-12-11 22:36:08 +01:00
parent 1bbe837184
commit 99bd12f0b1
5 changed files with 101 additions and 16 deletions

View file

@ -116,11 +116,6 @@ static void fetchTree(
attrs.emplace("type", type.value());
if (params.isFetchGit) {
// Default value; user attrs are assigned later.
attrs.emplace("exportIgnore", Explicit<bool>{true});
}
for (auto & attr : *args[0]->attrs) {
if (attr.name == state.sType) continue;
state.forceValue(*attr.value, attr.pos);
@ -144,6 +139,12 @@ static void fetchTree(
state.symbols[attr.name], showType(*attr.value)));
}
if (params.isFetchGit && !attrs.contains("exportIgnore")) {
// Default value; user attrs are assigned later.
// FIXME: exportIgnore := !submodules
attrs.emplace("exportIgnore", Explicit<bool>{true});
}
if (!params.allowNameArgument)
if (auto nameIter = attrs.find("name"); nameIter != attrs.end())
state.debugThrowLastTrace(EvalError({
@ -161,7 +162,10 @@ static void fetchTree(
fetchers::Attrs attrs;
attrs.emplace("type", "git");
attrs.emplace("url", fixGitURL(url));
attrs.emplace("exportIgnore", Explicit<bool>{true});
if (!attrs.contains("exportIgnore")) {
// FIXME: exportIgnore := !submodules
attrs.emplace("exportIgnore", Explicit<bool>{true});
}
input = fetchers::Input::fromAttrs(std::move(attrs));
} else {
if (!experimentalFeatureSettings.isEnabled(Xp::Flakes))