You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nix doesn't fetch repositories shallowly when told to #5119
rm -rf "$HOME/.cache/nix/gitv3"time nix build 'git+https://github.com/NixOS/nixpkgs?shallow=1#hello'# 9 s for metime git clone https://github.com/NixOS/nixpkgs --depth 1 --single-branch --branch=master # 250 s for me
Since Nix runs git internally, it should take around the same time, disregarding the time it takes to fetch hello from Hydra.
I think the use case is not reproducible and might be a misconception. Maybe hello or nixpkgs is already on the nix store and there's no need to fetch any sources?
When I tried nix shell "git+https://github.com/r-ryantm/nixpkgs.git?ref=auto-update/rt-tests?shallow=true#rt-tests", it downloaded the full nixpkgs repo. When shallow is supported there, it becomes much easier to test PRs
Activity
AleXoundOS commentedon Dec 24, 2021
Interesting, when did it break? Or was the bug around since the
shallowattribute has been introduced?yajo commentedon May 16, 2022
I think the use case is not reproducible and might be a misconception. Maybe
helloornixpkgsis already on the nix store and there's no need to fetch any sources?yajo commentedon May 19, 2022
I have been able to check it and it's definitely happening. Big problem here 😢
It seems this test just checks that nix derivation doesn't contain commit count, not that it's being really shallow:
nix/tests/fetchGit.sh
Line 204 in d354fc3
ImBearChild commentedon Oct 17, 2023
Well, maybe this parameter can only determine whether shallow clone is "allowed".
nix/src/libexpr/primops/fetchTree.cc
Lines 411 to 413 in e92cac7
According to the code, it just checks the local git repository if is "shallow repository" or not.
nix/src/libfetchers/git.cc
Lines 586 to 590 in e92cac7
And this parameter is never used when calling "git fetch". So it have no impact on how git fetches remote content.
nix/src/libfetchers/git.cc
Line 568 in e92cac7
poelzi commentedon Oct 20, 2023
nix run also ignores the shallow argument.
When I tried
nix shell "git+https://github.com/r-ryantm/nixpkgs.git?ref=auto-update/rt-tests?shallow=true#rt-tests", it downloaded the full nixpkgs repo. When shallow is supported there, it becomes much easier to test PRs