Skip to content

Commit

Permalink
fix(fetchers/git): dont fetch shallow by default
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra committed Jan 8, 2025
1 parent 8ce6284 commit 3779210
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/internal/fetchers/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;};
Expand All @@ -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;
}));

Expand All @@ -74,8 +74,7 @@ in {
b.fetchGit
(refAndRev
// {
inherit url submodules;
shallow = true;
inherit url submodules shallow;
allRefs = ! hasGitRef;
})
else
Expand Down

0 comments on commit 3779210

Please sign in to comment.