fetchFromGitHub: allow forcing fetchGit

This commit is contained in:
Sandro Jäckel 2021-09-26 15:41:34 +02:00 committed by Sandro Jäckel
parent b9f8421d48
commit 00dc3dcf8b

View file

@ -2,7 +2,7 @@
{ owner, repo, rev, name ? "source"
, fetchSubmodules ? false, leaveDotGit ? null
, deepClone ? false, private ? false
, deepClone ? false, private ? false, forceFetchGit ? false
, githubBase ? "github.com", varPrefix ? null
, ... # For hash agility
}@args:
@ -10,7 +10,7 @@ let
baseUrl = "https://${githubBase}/${owner}/${repo}";
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "private" "githubBase" "varPrefix" ];
varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_";
useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone;
useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit;
# We prefer fetchzip in cases we don't need submodules as the hash
# is more stable in that case.
fetcher = if useFetchGit then fetchgit else fetchzip;