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

nix run defaults to master for git+https URLs even when this isn't the remote's HEAD #5139

Open
remexre opened this issue Aug 15, 2021 · 2 comments

Comments

@remexre
Copy link

remexre commented Aug 15, 2021

Describe the bug

nix run (and presumably other Flake-involving commands) should default to using the default branch for git+https URLs, rather than hard-coding master.

I would guess this behavior comes from

if (!input.getRef()) input.attrs.insert_or_assign("ref", isLocal ? readHead(actualUrl) : "master");
, but I'm not familiar with the Nix codebase.

Steps To Reproduce

  1. Create a repo with a default branch other than master, and no master branch
  2. nix run git+https://...
  3. See fatal: couldn't find remote ref refs/heads/master

Expected behavior

The default branch of the remote should be used.

nix-env --version output

nix-env (Nix) 2.4pre20210707_02dd6bb

@remexre remexre added the bug label Aug 15, 2021
@abathur
Copy link
Member

abathur commented Aug 18, 2021

I am not sure if these just use the short form of fetchGit under the hood, but if so this is probably the same underlying issue as #4456

@stale
Copy link

stale bot commented Apr 17, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants