1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Merge pull request #9413 from edolstra/fetchToStore-cache

Persistently cache `InputAccessor::fetchToStore()`
This commit is contained in:
Eelco Dolstra 2023-11-22 12:19:25 +01:00 committed by GitHub
commit 38844943d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 3 deletions

View file

@ -705,10 +705,22 @@ struct GitInputScheme : InputScheme
auto repoInfo = getRepoInfo(input);
return
auto [accessor, final] =
input.getRef() || input.getRev() || !repoInfo.isLocal
? getAccessorFromCommit(store, repoInfo, std::move(input))
: getAccessorFromWorkdir(store, repoInfo, std::move(input));
accessor->fingerprint = final.getFingerprint(store);
return {accessor, std::move(final)};
}
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
{
if (auto rev = input.getRev())
return rev->gitRev() + (getSubmodulesAttr(input) ? ";s" : "");
else
return std::nullopt;
}
};