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

builtins.fetchGit doesn't fetch submodules #2151

Closed
ElvishJerricco opened this issue May 10, 2018 · 14 comments · Fixed by #3166
Closed

builtins.fetchGit doesn't fetch submodules #2151

ElvishJerricco opened this issue May 10, 2018 · 14 comments · Fixed by #3166
Assignees

Comments

@ElvishJerricco
Copy link
Contributor

No description provided.

@edolstra edolstra self-assigned this May 11, 2018
@ElvishJerricco
Copy link
Contributor Author

This is a pretty big blocker for me. I can't reasonably use builtins.fetchGit without submodule support.

@langston-barrett
Copy link
Contributor

At least when building with nixpkgs, one can use

  src = fetchgit {
    url = "https://github.com/GaloisInc/some-repo.git";
    deepClone = true;
    sha256 = ...;
    rev = ...;
  };

@NorfairKing
Copy link

NorfairKing commented Oct 28, 2018

This is also a blocker for me. Specifically when it comes to private git repositories that have submodules.
I looked around in the code to see what would have to be changed to allow for deepClone = true in builtins.fetchGit:

runProgram("git", true, { "-C", cacheDir, "fetch", "--quiet", "--force", "--", uri, *ref + ":" + localRef });

It looks like the current approach with a bare repository and git fetch instead of git clone will not work because submodules require a working tree and cannot work with a bare repository.
Either we fix up git, or we do a full git clone --recursive and remove the .git directories recursively inside that.

cc @nh2, Thanks for the help!

@tbenst
Copy link

tbenst commented Jun 16, 2019

This issue causes difficult to debug error messages when trying to package PyToch 1.1 (NixOS/nixpkgs#63073), and probably elsewhere, too. I took a clumsy stab at getting nested level of 2 to work with no luck: NixOS/nixpkgs@master...tbenst:pytorch11#diff-8c857b370607b23d073067f7df717593

@qolii
Copy link

qolii commented Aug 29, 2019

Any progress/interest on this one?

@tbenst
Copy link

tbenst commented Aug 30, 2019

@qolii might want to check out NixOS/nixpkgs#61820 (comment). I'm no longer sure if this issue is valid?

@evanjs
Copy link
Member

evanjs commented Aug 30, 2019

@qolii might want to check out NixOS/nixpkgs#61820 (comment). I'm no longer sure if this issue is valid?

I think fetchGit is still somewhat preferred if private repos are used. Somebody please correct me if I’m wrong.

@qolii
Copy link

qolii commented Aug 30, 2019

I think fetchGit is still somewhat preferred if private repos are used.

Exactly. From my reading, NixOS/nixpkgs#61820 is using pkgs.fetchgit. But that seems to be very difficult to use with private repos (my use case), whereas builtins.fetchGit is much more amenable.

@blitz
Copy link
Contributor

blitz commented Oct 23, 2019

I also ended up here, because I wanted to clone a private repository with submodules.

@tfc

@qolii
Copy link

qolii commented Oct 25, 2019

Looking quickly at fetchgit.cc, this appears like it would be trivial?

  • Add another input argument to builtins.fetchGit, along the lines of a boolean fetchSubmodules or so)
  • Then based on it, add a conditional extra call to runProgram, to perform a git submodule init.

I am sure I am missing something... Please let me know. If it is this easy, I can put a patch together myself.

Ok, so, I should have actually paid attention to @NorfairKing's comment earlier. Sorry!

Did you make any progress with your git clone --recursive approach?

@NorfairKing
Copy link

@qolii I made no attempt to 'fix' this issue. I'm working around it by making my repos public :)

@blitz
Copy link
Contributor

blitz commented Oct 25, 2019

I've given this a shot after a discussion with @edolstra and @tfc at NixCon. Comments welcome.

@knedlsepp
Copy link
Member

Finally it's happening. Can't wait for the next release. ❤️

@jakubgs
Copy link

jakubgs commented Oct 13, 2020

Any news on when this will be included in a release?

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 a pull request may close this issue.

10 participants