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

Plain git fetcher doesn't accept tags for "ref =" #5449

Closed
mikepurvis opened this issue Oct 30, 2021 · 3 comments
Closed

Plain git fetcher doesn't accept tags for "ref =" #5449

mikepurvis opened this issue Oct 30, 2021 · 3 comments
Labels

Comments

@mikepurvis
Copy link

mikepurvis commented Oct 30, 2021

Describe the bug

The docs here seem to indicate "ref: A Git or Mercurial branch or tag name", however, support for tags is incomplete— note that looks for the name as if it was a branch:

$ nix develop clearpath/2.24.0-20211029234926 --show-trace
fetching Git repository 'http://gitlab.clearpathrobotics.com/sweng-infra/nix.git'fatal: couldn't find remote ref refs/heads/2.24.0-20211029234926
fatal: the remote end hung up unexpectedly
error: program 'git' failed with exit code 128

If I fully specify the ref then it works, but then I can't use the nice registry alias because the ref has slashes in it:

$ nix build git+http://gitlab.clearpathrobotics.com/sweng-infra/nix.git?ref=refs/tags/2.24.0-20211029234926

Pretty sure this is the problem code here:

nix/src/libfetchers/git.cc

Lines 372 to 379 in 4ed6673

auto fetchRef = allRefs
? "refs/*"
: ref->compare(0, 5, "refs/") == 0
? *ref
: ref == "HEAD"
? *ref
: "refs/heads/" + *ref;
runProgram("git", true, { "-C", repoDir, "fetch", "--quiet", "--force", "--", actualUrl, fmt("%s:%s", fetchRef, fetchRef) });

My version is 2.4pre20210601_5985b8b.

@mikepurvis mikepurvis added the bug label Oct 30, 2021
@stale
Copy link

stale bot commented Apr 28, 2022

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

@stale stale bot added the stale label Apr 28, 2022
@ncfavier
Copy link
Member

ncfavier commented May 3, 2022

Most likely a duplicate of #5291

@stale stale bot removed the stale label May 3, 2022
@mikepurvis
Copy link
Author

@ncfavier Indeed it is, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants