Unverified Commit 42637c30 authored by Michael Daniels's avatar Michael Daniels
Browse files

fetchFromGitHub: use fetchgit when the rootDir option is set



This argument was added to fetchgit in #427165,
and it's not supported by fetchzip.

Co-authored-by: default avatarPhilip Taron <philip.taron@gmail.com>
parent 638e1bf5
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -860,7 +860,14 @@ A number of fetcher functions wrap part of `fetchurl` and `fetchzip`. They are m

To use a different GitHub instance, use `githubBase` (defaults to `"github.com"`).

`fetchFromGitHub` uses `fetchzip` to download the source archive generated by GitHub for the specified revision. If `leaveDotGit`, `deepClone` or `fetchSubmodules` are set to `true`, `fetchFromGitHub` will use `fetchgit` instead. Refer to its section for documentation of these options.
By default, `fetchFromGitHub` uses `fetchzip` to download GitHub's source archive for the specified revision.
However, `fetchFromGitHub` will automatically switch to using `fetchgit` in any of these cases:

- `forceFetchGit`, `leaveDotGit`, `deepClone`, `fetchLFS`, or `fetchSubmodules` are set to `true`
- `sparseCheckout` contains any entries (is a non-empty list)
- `rootDir` is set to a non-empty string

When `fetchgit` is used, refer to the `fetchgit` section for documentation of its available options.

## `fetchFromGitLab` {#fetchfromgitlab}

+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ lib.makeOverridable (
    private ? false,
    forceFetchGit ? false,
    fetchLFS ? false,
    sparseCheckout ? [ ],
    rootDir ? "",
    sparseCheckout ? lib.optional (rootDir != "") rootDir,
    githubBase ? "github.com",
    varPrefix ? null,
    meta ? { },
@@ -69,6 +70,7 @@ lib.makeOverridable (
      || deepClone
      || forceFetchGit
      || fetchLFS
      || (rootDir != "")
      || (sparseCheckout != [ ]);
    # We prefer fetchzip in cases we don't need submodules as the hash
    # is more stable in that case.