-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Optionally allow git filters to be applied when reading blobs #13993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Discussed in team meeting today:
|
For awareness, I have built a second patch on top of this patch to "smooth over" the breaking change that was made between nix < 2.20 and nix >= 2.20 with the handling of
This is intended to support a migration at Day Job where we can:
This additional patch is available here (for visibility): 2.31-maintenance...GrahamDennis:nix:gdennis/backcompat-2.31.2 If it is desired or considered more broadly useful, I can add this as a separate PR on top of this PR (assuming a version of this PR is accepted). My assumption is that this use case is sufficiently niche to not be worth merging into nix. |
Motivation
Nix 2.20 introduced a regression (a breaking change) in which git repositories do not properly have filters applied (specifically filters that are configured via
.gitattributes
). This manifests as "NAR hash mismatch" errors when users are upgrading from earlier versions and they have a dependency that uses.gitattributes
to manipulate line endings.curl
is the most notable example I am aware of which, for example, specifies in.gitattributes
that*.bat
files should have CRLF line endings.This change differs from #13428 in that the nix 2.20 behavior is retained as the default, with the previous behavior now being opt-in via the optional
applyFilters
attribute to git flake inputs. As such, this PR does not introduce a breaking change.Context
Fixes #11428, alternative to #13428.
The current nix behaviour seems completely broken when it comes to handling git filters.
The output of the above script on my machine is as follows:
This shows that the way Nix is handling git repositories is inconsistent with git, irrespective of the user and/or system git configuration.
Another manifestation of this bug is that the NAR hash for a git repository can change depending on the order of evaluations. This can be demonstrated by the following script:
The output of this script is as follows:
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.