mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
GitInputScheme::getFingerprint(): Taking the submodules setting into account
This setting changes the contents of the tree, so it affects the evaluation cache and store path cache.
This commit is contained in:
parent
2d76ef0b7b
commit
639db1e4a8
1 changed files with 15 additions and 1 deletions
|
@ -295,6 +295,11 @@ struct GitInputScheme : InputScheme
|
|||
std::string gitDir = ".git";
|
||||
};
|
||||
|
||||
bool getSubmodulesAttr(const Input & input) const
|
||||
{
|
||||
return maybeGetBoolAttr(input.attrs, "submodules").value_or(false);
|
||||
}
|
||||
|
||||
RepoInfo getRepoInfo(const Input & input) const
|
||||
{
|
||||
auto checkHashType = [&](const std::optional<Hash> & hash)
|
||||
|
@ -308,7 +313,7 @@ struct GitInputScheme : InputScheme
|
|||
|
||||
RepoInfo repoInfo {
|
||||
.shallow = maybeGetBoolAttr(input.attrs, "shallow").value_or(false),
|
||||
.submodules = maybeGetBoolAttr(input.attrs, "submodules").value_or(false),
|
||||
.submodules = getSubmodulesAttr(input),
|
||||
.allRefs = maybeGetBoolAttr(input.attrs, "allRefs").value_or(false)
|
||||
};
|
||||
|
||||
|
@ -776,6 +781,15 @@ struct GitInputScheme : InputScheme
|
|||
{
|
||||
return (bool) input.getRev();
|
||||
}
|
||||
|
||||
std::optional<std::string> getFingerprint(ref<Store> store, const Input & input) const override
|
||||
{
|
||||
if (auto rev = input.getRev()) {
|
||||
return fmt("%s;%s", rev->gitRev(), getSubmodulesAttr(input) ? "1" : "0");
|
||||
} else
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static auto rGitInputScheme = OnStartup([] { registerInputScheme(std::make_unique<GitInputScheme>()); });
|
||||
|
|
Loading…
Reference in a new issue