-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Prevent fetchGit from using incorrect cached rev for different refs #7174
Conversation
When fetching a non-local git repo by ref (and no rev), don't consider unrelated cached revs for the same repository.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. It's indeed much more correct to include the ref in the cache key 👍
@thufschmitt: Is there anything else to address before this can be merged? I have a few co-workers who have been affected by #7146 , so I'd be happy to make any changes needed. |
Nope sorry, I guess I just forgot to press the merge button 😬 Thanks @edolstra for the merge :) |
I merged this into the lazy-trees PR by deleting the changes to |
Just manually tested the example in the description with your |
Heyo we're seeing some weird behavior happening within our production landscape and we feel like it relates to this PR. getFlake on a remote flake using a We do not specify a It works again if we This issue started occuring when we upgraded our engineers from 2.4 to 2.11.1 |
This seems like a major issue. Should it be back-ported to earlier versions of nix? it seems to have started in nix 2.9 |
Prevent fetchGit from using incorrect cached rev for different refs
Background
This is a fix for #7146.
When using
fetchGit
on a non-local repository and using aref
(but norev
),fetchGit
will decide that any cachedrev
for that repository is usable (if not too stale).This is potentially really disruptive. If a user uses
fetchGit
to fetch both thenixos-22.05
andnixos-21.11
branches ofnixpkgs
back-to-back, and they don't specify arev
, they'll wind up withnixos-22.05
sources in both cases (!!):The fix
The fix I'm suggesting is pretty straightforward: when no
rev
is provided for a remote repo fetched with fetchGit, incorporate theref
into theinput
attrs to differentiate cached revs between different refs.To illustrate, here's the fetcher cache after running the example above in Nix 2.9.1:
and this is how it looks on my bugfix branch: