diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc index 6d73daa1a..7ab1f567a 100644 --- a/src/libfetchers/fetchers.cc +++ b/src/libfetchers/fetchers.cc @@ -355,7 +355,7 @@ std::pair, Input> Input::getAccessorUnchecked(ref sto assert(!accessor->getFingerprint(CanonPath::root)); - if (auto fingerprint = getFingerprint(store)) + if (auto fingerprint = result.getFingerprint(store)) accessor->setFingerprint(*fingerprint); return {accessor, std::move(result)}; diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index e335fe6f3..51f1909a2 100755 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -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" "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. # This may change in the future once git submodule support is refined. # See: https://discourse.nixos.org/t/57783 and #9708.