-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
fetchgit: add tag argument #50492
fetchgit: add tag argument #50492
Conversation
b0fe64f
to
a79fd25
Compare
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.
Good idea! This should probably be documented somewhere right? Will this also indirectly affect fetchFromGitHub
?
While it is possible to pass `rev = tag` to fetchgit, it may result in ambiguity when here is a branch with the same name as the tag. To be sure, we need to use `rev = "refs/tags/${tag}"`. Since that is quite ugly, this commit introduces a shortcut, allowing us to just `inherit tag`.
a79fd25
to
312b2e1
Compare
I did not find any place where This will have no effect on |
Well thats one upside of not having documentation I guess. Nothing to update. Should we then do the same thing with |
Added the argument to Needed to escape the building '/nix/store/cxfkh2lgfbhhpgcphsh8wkn2j25y50hn-source.drv'...
Also I am not sure about what should the |
then { inherit rev fetchSubmodules; url = "${baseUrl}.git"; } | ||
else ({ url = "${baseUrl}/archive/${rev}.tar.gz"; } // privateAttrs) | ||
then { inherit rev tag fetchSubmodules; url = "${baseUrl}.git"; } | ||
else ({ url = "${baseUrl}/archive/${revOrTag}.tar.gz"; } // privateAttrs) |
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.
Did you forget to escape here?
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.
GitHub does not seem to need escaping. GitLab does not need it either but fetchzip does, in order to be able to extract the file.
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.
Oh nevermind I see the difference. Isn't there still some escaping necessary, just not of the /
?
AFAIK tags have precedence over a branch refs https://git-scm.com/docs/git-rev-parse.html#_specifying_revisions, i.e. |
Then I do not understand why |
escapeUriSegment "foo/bar?baz=qux&quux=quuz#corge" | ||
=> "foo%2Fbar%3Fbaz%3Dqux%26quux%3Dquuz%23corge" | ||
*/ | ||
escapeUriSegment = arg: |
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.
This sort of thing should not be done in Nix code because it's slow. You can also do escaping in the builder.
Not really in favor of this because it makes |
Motivation for this change
While it is possible to pass
rev = tag
tofetchgit
, it may result in ambiguity when here is a branch with the same name as the tag. To be sure, we need to userev = "refs/tags/${tag}"
.Since that is quite ugly, this commit introduces a shortcut, allowing us to just
inherit tag
.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)