From 3779210e494f9ebc6c3ef62cc17c59b18960c2b2 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Fri, 4 Oct 2024 06:59:20 +0300 Subject: [PATCH] fix(fetchers/git): dont fetch shallow by default --- lib/internal/fetchers/git/default.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/internal/fetchers/git/default.nix b/lib/internal/fetchers/git/default.nix index e70895a2b0..9a6791471f 100644 --- a/lib/internal/fetchers/git/default.nix +++ b/lib/internal/fetchers/git/default.nix @@ -22,12 +22,13 @@ in { url, rev, submodules ? true, + shallow ? false, ... } @ inp: let - isRevGitRef = isGitRef rev; + isRevGitRef = isGitRef rev != null; hasGitRef = inp.ref or null != null; in - if isRevGitRef == null && isGitRev rev == null + if ! isRevGitRef && isGitRev rev == null then throw '' invalid git rev: ${rev} @@ -47,7 +48,7 @@ in { if hasGitRef then {inherit (inp) rev ref;} # otherwise check if the rev is a ref, if it is add to ref - else if isRevGitRef != null + else if isRevGitRef then {ref = inp.rev;} # if the rev isn't a ref, then it is a rev, so add it there else {rev = inp.rev;}; @@ -57,9 +58,8 @@ in { (b.fetchGit (refAndRev // { - inherit url submodules; + inherit url submodules shallow; # disable fetching all refs if the source specifies a ref - shallow = true; allRefs = ! hasGitRef; })); @@ -74,8 +74,7 @@ in { b.fetchGit (refAndRev // { - inherit url submodules; - shallow = true; + inherit url submodules shallow; allRefs = ! hasGitRef; }) else