Skip to content
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

import-flake: detect default branches correctly #114

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

stuebinm
Copy link
Contributor

@stuebinm stuebinm commented Feb 8, 2025

See #113

Previously, npins import-flake would simply assume that the branch was called master if not given, which is not correct; nix flakes will use the remote's default branch in such cases.

This mimics the behaviour in the flake importer — however, perhaps it might be better to move it into the Pin struct itself, allowing branch pins with no explicit branch name given, which then resolve to the remote's default branch instead?

Previously, `niv import-flake' would simply assume that the branch
was called `master' if not given, which is not correct; nix flakes
will use the remote's default branch in such cases.

This mimics the behaviour in the flake importer — however, perhaps
it might be better to move it into the Pin struct itself, allowing
branch pins with no explicit branch name given, which then resolve
to the remote's default branch instead?
@KiaraGrouwstra
Copy link

thanks! this indeed addresses #113 for me ✌️

@piegamesde
Copy link
Collaborator

however, perhaps it might be better to move it into the Pin struct itself, allowing branch pins with no explicit branch name given, which then resolve to the remote's default branch instead?

how would that look like, UI wise? Because currently the default is to use a release, and a branch is only used when one is specified. So unclear how it would fit in

@stuebinm
Copy link
Contributor Author

I haven't thought about it in detail — perhaps we could have something like npins add git <url> --default-branch.

I'm not overlay attached to the idea and have little opinion on whether we want to have it or not, but I wanted to mention it here since it's a bit of a "low-hanging fruit" to add, should it be something people are interested in having (e.g. one might argue nix flakes do this, so we want this too, etc.)

@piegamesde piegamesde merged commit 9d43294 into andir:master Feb 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants