-
Notifications
You must be signed in to change notification settings - Fork 248
Add "branch" information for builtins.fetchGit #1019
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
Conversation
So, I was actually hoping we could get away from the magic comments. We have the |
A minimal solution might be a |
Thanks for your hints @michaelpj . I understand the move, I’ll try to have a look at that. I remember seeing this sha256map in haskell.nix, I shall try to adapt it for branches. |
This is the counterpart of nix-tools proposed change: input-output-hk/nix-tools#99
3f185cd
to
201cf5f
Compare
I implemented the suggested change. Now the change in nix-tools is not needed anymore 😌 |
This should close #592, also. |
Thanks for the digging of issues, I didn’t do my part of the job before submitting it seems 🙇 |
bors try |
tryBuild succeeded: |
I just tried out this change on latest master; but this does not fix issue #592 for me.
using: extra-deps:
# https://github.com/hspec/hspec-wai/pull/49
# nix-branch: body-contains
- git: https://github.com/wireapp/hspec-wai
commit: 0a5142cd3ba48116ff059c041348b817fb7bdb25 Edit: |
@arianvp : the "nix-branch comment hack" was discussed and discarded finally, because it doesn’t follow the way that haskell.nix is planned to evolve.
the modification of the lookupBranch is because the default implementation also looks at the wanted commit.
Hope it’s clearer that way? |
The builtins.fetchGit used by haskell.nix clones only the subset of a repository corresponding to HEAD. So if we have a workflow that has a branch "development" as HEAD, but the stack.yaml only targets commits from "master", then it will be unable to fetch any commit. Fixes input-output-hk#592
Commenting from way in the future, I guess - The entire selling point of Requiring devs to update the -- https://github.com/haskell-servant/servant/pull/1592
source-repository-package
--sha256: sha256-DcgeE37DJy6+sUvkbKdnk1Cy9LyATgPHaPZ0ifj/qtg=
+ --nix-branch: ghc-9.4
type: git
location: https://github.com/TeofilC/servant.git
tag: a53d69929cf6fe531bb25aec65e7ab6405278459
subdir:
servant
servant-client
servant-client-core than this much noisier and heavily duplicated thing: + branchMap = {
+ "https://github.com/TeofilC/servant.git"."a53d69929cf6fe531bb25aec65e7ab6405278459" =
+ "ghc-9.4";
+ }; Additionally, we now have a non-local addition to the source-of-truth for the build. OTOH, I understand that as a maintainer, the magic comments are likely Worse. But as a user, the UX of just putting a magic comment in the relevant definition for the in the source of truth for the package. I don't expect y'all to cater your project just to me opinons, but I do want to provide some user feedback on the design decision here. |
@parsonsmatt I agree on the idea, but the difference here comes from git: since it is not possible to "fetch" (in the git sense) only a commit from a repository, nix and stack have a different way of working around that:
so the only ways of getting what you want (which, again, is a reasonnable wish) is
|
(NB: @ismaelbouyaf and I are the same person, the former one was a company account to which I lost access when the company terminated) |
This is a very reasonable desire, but it's slightly different to what I think our working goal is. Our goal is to follow the project configuration as the source of truth so that we do not diverge from it, not so that it can be the only thing you need to touch to configure your project. We are quite far from that. So that's just to explain: I don't think we're optimizing for the same thing. And aside from that... personally I have the opposite feeling. I want my |
The builtins.fetchGit used by haskell.nix clones only the subset of a
repository corresponding to HEAD. So if we have a workflow that has a
branch "development" as HEAD, but the stack.yaml only targets commits
from "master", then it will be unable to fetch any commit.
Fixes #592