Loading
fetchFromGitHub: use of the API endpoint only when fetching tarball
https://github.com/NixOS/nixpkgs/pull/321484 introduced a bug when when `forceFetchGit=true`. This PR revert the change only for this case. The previous PR made work cases like: ```bash nix-build -E 'let pkgs = import ./nixpkgs {}; in pkgs.fetchFromGitHub { owner = "<username>"; repo = "<repo>"; rev = "HEAD"; hash = ""; private=true; forceFetchGit=false; }' ``` You should see the download working and nix complaining about hash mismatch. Now if you take the case where `forceFetchGit=true`, this is a different story: ``` nix-build -E 'let pkgs = import ./nixpkgs {}; in pkgs.fetchFromGitHub { owner = "<username>"; repo = "<repo>"; rev = "HEAD"; hash = ""; private=true; forceFetchGit=true; }' ``` Logs look like: ``` Initialized empty Git repository in /nix/store/<hash>-source/.git/ fatal: could not read Username for 'https://github.com': No such device or address fatal: could not read Username for 'https://github.com': No such device or address fatal: could not read Username for 'https://github.com': No such device or address fatal: could not read Username for 'https://github.com': No such device or address Unable to checkout HEAD from https://github.com/<username>/<repo>.git. ``` I was using `forceFetchGit` for the exact reason the previous PR was made, I will move to `forceFetchGit=false` now. Still the previous PR was a broke usage of `fetchFromGitHub` force private repository when `forceFetchGit` is used.