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

Optimisation

This commit is contained in:
Eelco Dolstra 2024-12-04 15:31:19 +01:00
parent b9f60faab5
commit 33852ead6b
3 changed files with 16 additions and 25 deletions

View file

@ -686,7 +686,7 @@ struct GitInputScheme : InputScheme
if (getSubmodulesAttr(input))
/* Create mountpoints for the submodules. */
for (auto & submodule : repoInfo.workdirInfo.submodules)
repoInfo.workdirInfo.files.emplace(submodule.path, GitRepo::WorkdirInfo::State::Clean);
repoInfo.workdirInfo.files.insert(submodule.path);
auto repo = GitRepo::openRepo(repoInfo.url, false, false);
@ -807,12 +807,11 @@ struct GitInputScheme : InputScheme
/* Calculate a fingerprint that takes into account the
deleted and modified/added files. */
HashSink hashSink{HashAlgorithm::SHA512};
for (auto & file : repoInfo.workdirInfo.files)
if (file.second == GitRepo::WorkdirInfo::State::Dirty) {
writeString("modified:", hashSink);
writeString(file.first.abs(), hashSink);
dumpPath(repoInfo.url + "/" + file.first.abs(), hashSink);
}
for (auto & file : repoInfo.workdirInfo.dirtyFiles) {
writeString("modified:", hashSink);
writeString(file.abs(), hashSink);
dumpPath(repoInfo.url + "/" + file.abs(), hashSink);
}
for (auto & file : repoInfo.workdirInfo.deletedFiles) {
writeString("deleted:", hashSink);
writeString(file.abs(), hashSink);