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

fetchGit: allow fetching explicit refs #2582

Merged
merged 2 commits into from Jul 2, 2019
Merged

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Dec 14, 2018

Trying to fetch refs that are not in refs/heads currently fails because
it looks for refs/heads/refs/foo instead of refs/foo.

This enables some cool stuff like fetching the magic pull-request refs from github.

builtins.fetchGit {
  url = https://github.com/NixOS/nixpkgs.git;
  ref = "refs/pull/1024/head;
}

Trying to fetch refs that are not in refs/heads currently fails because
it looks for refs/heads/refs/foo instead of refs/foo.

eg.

	builtins.fetchGit {
	  url = https://github.com/NixOS/nixpkgs.git;
	  ref = "refs/pull/1024/head;
	}
ajs124 added a commit to ajs124/NixDroid that referenced this pull request Feb 26, 2019
ajs124 added a commit to ajs124/NixDroid that referenced this pull request Feb 27, 2019
ajs124 added a commit to ajs124/NixDroid that referenced this pull request Feb 27, 2019
@lionello
Copy link

I wonder if this would address #2385 as well.

@FRidh
Copy link
Member

FRidh commented Apr 16, 2019

Related issue on fetchGit #2409.

I really would like to see this in.

@lheckemann
Copy link
Member

+1 @edolstra anything blocking merging this?

@dasJ
Copy link
Member

dasJ commented Jul 1, 2019

@edolstra Ping again

@grahamc
Copy link
Member

grahamc commented Jul 2, 2019

I pushed a commit documenting this.

@edolstra edolstra merged commit 33db1d3 into NixOS:master Jul 2, 2019
@edolstra
Copy link
Member

edolstra commented Jul 2, 2019

BTW I just noticed we're not validating ref, so it's only thanks to Git validating it that you can't do things like

fetchGit { url = https://github.com/NixOS/patchelf.git; ref = "../../../../../../etc/passwd"; }

@LnL7 LnL7 deleted the fetchgit-refs branch July 2, 2019 16:41
jtanguy added a commit to jtanguy/nix that referenced this pull request Sep 11, 2019
With the merge of NixOS#2582, the syntax "tags/1.9" for refs does not work
anymore.
However, the new syntax "refs/tags/1.9" seems to support annotated tags,
such as "refs/tags/2.0".

Closes NixOS#2385.
p01arst0rm pushed a commit to p01arst0rm/nix that referenced this pull request Oct 2, 2019
With the merge of NixOS#2582, the syntax "tags/1.9" for refs does not work
anymore.
However, the new syntax "refs/tags/1.9" seems to support annotated tags,
such as "refs/tags/2.0".

Closes NixOS#2385.
edolstra pushed a commit that referenced this pull request Oct 9, 2019
With the merge of #2582, the syntax "tags/1.9" for refs does not work
anymore.
However, the new syntax "refs/tags/1.9" seems to support annotated tags,
such as "refs/tags/2.0".

Closes #2385.

(cherry picked from commit ae244af)
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.

None yet

7 participants