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

git fetcher: Add exportIgnore parameter

Enabled for fetchGit, which historically had this behavior,
among other behaviors we do not want in fetchGit.

fetchTree disables this parameter by default. It can choose the
simpler behavior, as it is still experimental.

I am not confident that the filtering implementation is future
proof. It should reuse a source filtering wrapper, which I believe
Eelco has already written, but not merged yet.
This commit is contained in:
Robert Hensing 2023-11-27 22:34:41 +01:00
parent 4d0ecda33e
commit ce6d58a97c
5 changed files with 81 additions and 14 deletions

View file

@ -39,6 +39,10 @@ void emitTreeAttrs(
attrs.alloc("submodules").mkBool(
fetchers::maybeGetBoolAttr(input.attrs, "submodules").value_or(false));
if (input.getType() == "git")
attrs.alloc("exportIgnore").mkBool(
fetchers::maybeGetBoolAttr(input.attrs, "exportIgnore").value_or(false));
if (!forceDirty) {
if (auto rev = input.getRev()) {
@ -112,6 +116,11 @@ 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);
@ -593,6 +602,11 @@ static RegisterPrimOp primop_fetchGit({
A Boolean parameter that specifies whether submodules should be checked out.
- `exportIgnore` (default: `true`)
A Boolean parameter that specifies whether `export-ignore` from `.gitattributes` should be applied.
This approximates part of the `git archive` behavior.
- `shallow` (default: `false`)
A Boolean parameter that specifies whether fetching from a shallow remote repository is allowed.