1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 04:56:01 +01:00

Fix broken fetchToStore() caching on unlocked inputs

This commit is contained in:
Eelco Dolstra 2025-06-13 15:21:31 +02:00
parent e84daa23f7
commit cbedb8e19a
2 changed files with 7 additions and 1 deletions

View file

@ -355,7 +355,7 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessorUnchecked(ref<Store> sto
assert(!accessor->getFingerprint(CanonPath::root)); assert(!accessor->getFingerprint(CanonPath::root));
if (auto fingerprint = getFingerprint(store)) if (auto fingerprint = result.getFingerprint(store))
accessor->setFingerprint(*fingerprint); accessor->setFingerprint(*fingerprint);
return {accessor, std::move(result)}; return {accessor, std::move(result)};

View file

@ -112,6 +112,12 @@ nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir#default"
nix build -o "$TEST_ROOT/result" "$flake1Dir?ref=HEAD#default" nix build -o "$TEST_ROOT/result" "$flake1Dir?ref=HEAD#default"
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default"
# Check that the fetcher cache works.
if [[ $(nix config show lazy-trees) = false ]]; then
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuietInverse "source path.*is uncacheable"
nix build -o "$TEST_ROOT/result" "git+file://$flake1Dir?ref=HEAD#default" -vvvvv 2>&1 | grepQuiet "store path cache hit"
fi
# Check that relative paths are allowed for git flakes. # Check that relative paths are allowed for git flakes.
# This may change in the future once git submodule support is refined. # This may change in the future once git submodule support is refined.
# See: https://discourse.nixos.org/t/57783 and #9708. # See: https://discourse.nixos.org/t/57783 and #9708.