mirror of
https://github.com/NixOS/nix
synced 2025-07-01 16:41:47 +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";
|
std::string gitDir = ".git";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool getSubmodulesAttr(const Input & input) const
|
||||||
|
{
|
||||||
|
return maybeGetBoolAttr(input.attrs, "submodules").value_or(false);
|
||||||
|
}
|
||||||
|
|
||||||
RepoInfo getRepoInfo(const Input & input) const
|
RepoInfo getRepoInfo(const Input & input) const
|
||||||
{
|
{
|
||||||
auto checkHashType = [&](const std::optional<Hash> & hash)
|
auto checkHashType = [&](const std::optional<Hash> & hash)
|
||||||
|
@ -308,7 +313,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
RepoInfo repoInfo {
|
RepoInfo repoInfo {
|
||||||
.shallow = maybeGetBoolAttr(input.attrs, "shallow").value_or(false),
|
.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)
|
.allRefs = maybeGetBoolAttr(input.attrs, "allRefs").value_or(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -776,6 +781,15 @@ struct GitInputScheme : InputScheme
|
||||||
{
|
{
|
||||||
return (bool) input.getRev();
|
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>()); });
|
static auto rGitInputScheme = OnStartup([] { registerInputScheme(std::make_unique<GitInputScheme>()); });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue