Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fetchers/git): dont fetch shallow by default #1055

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading