mirror of
https://github.com/NixOS/nix
synced 2025-06-24 13:51:16 +02:00
Merge 09a7ce962d
into aa1629ca35
This commit is contained in:
commit
94bd7a5f49
2 changed files with 9 additions and 2 deletions
|
@ -168,8 +168,10 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
|||
parsedURL.query.insert_or_assign("dir", subdir);
|
||||
}
|
||||
|
||||
if (pathExists(flakeRoot + "/.git/shallow"))
|
||||
parsedURL.query.insert_or_assign("shallow", "1");
|
||||
if (!parsedURL.query.count("shallow")) {
|
||||
// We assume shallow by default, so we don't need to compute the revCount, which is an expensive operation.
|
||||
parsedURL.query.insert_or_assign("shallow", "1");
|
||||
}
|
||||
|
||||
return fromParsedURL(fetchSettings, std::move(parsedURL), isFlake);
|
||||
}
|
||||
|
|
|
@ -65,3 +65,8 @@ fi
|
|||
# Verify that we can shallow fetch the worktree
|
||||
git -C "$TEST_ROOT/shallow-worktree" rev-list --count HEAD >/dev/null
|
||||
nix eval --impure --raw --expr "(builtins.fetchGit { url = \"file://$TEST_ROOT/shallow-worktree\"; shallow = true; }).rev"
|
||||
|
||||
# Normal flake operation work because they use shallow by default
|
||||
pushd "$TEST_ROOT/shallow-worktree"
|
||||
nix flake metadata
|
||||
popd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue