fetchTree: apply Git defaults consistently to URL and attribute inputs - #16428
Open
wangyusheng1985 wants to merge 1 commit into
Open
fetchTree: apply Git defaults consistently to URL and attribute inputs#16428wangyusheng1985 wants to merge 1 commit into
wangyusheng1985 wants to merge 1 commit into
Conversation
Keep URL-like and parsed inputs equivalent by applying the shallow default after normalization. Assisted-by: Claude Code (model unspecified) Signed-off-by: wangyusheng1985 <wangyusheng1985@users.noreply.github.com>
wangyusheng1985
marked this pull request as ready for review
September 4, 2026 22:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
builtins.fetchTreeapplied its documented Gitshallow = truedefault only to attribute-set arguments. A directgit+...URL therefore exposed different metadata than the equivalent result ofbuiltins.parseFlakeRef.Move default handling after argument normalization so both representations receive identical Git defaults. Explicit
shallowvalues andbuiltins.fetchGitbehavior remain unchanged.Add a functional regression test comparing the complete result sets and document the equivalence.
Validation
fetchGitfunctional test.Closes: #12860
Automation disclosure
This patch and pull request draft were prepared with Claude Code (model unspecified) and require human review before submission.
Validation observed for this change:
docker run --rm --mount type=bind,src=/workspace/repository,dst=/src,readonly -w /src nixos/nix@sha256:cf7393e408da5ad343dad43670be72d7ee062b2a6a687990e9613ef9dc8bf2f6 nix build --no-link --print-build-logs --extra-experimental-features 'nix-command flakes' 'path:/src#nix-cli' 'path:/src#nix-manual'docker run --rm --mount type=bind,src=/workspace/repository,dst=/src,readonly -w /src nixos/nix@sha256:cf7393e408da5ad343dad43670be72d7ee062b2a6a687990e9613ef9dc8bf2f6 nix build --no-link --print-build-logs --impure --extra-experimental-features 'nix-command flakes' --expr 'let flake = builtins.getFlake "path:/src"; package = flake.packages.x86_64-linux.nix-functional-tests; in package.overrideAttrs (old: { mesonCheckFlags = (old.mesonCheckFlags or []) ++ [ "fetchGit" ]; })'docker run --rm --mount type=bind,src=/workspace/repository,dst=/src,readonly -w /src nixos/nix@sha256:cf7393e408da5ad343dad43670be72d7ee062b2a6a687990e9613ef9dc8bf2f6 nix build --no-link --print-build-logs --extra-experimental-features 'nix-command flakes' 'path:/src#checks.x86_64-linux.pre-commit'Fixes #12860