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

Cache calls to GitRepo::getWorkdirInfo()

A command like `nix flake metadata` was causing about 4 calls to
getWorkdirInfo(), which is slow for large repos (even when they're not
dirty).
This commit is contained in:
Eelco Dolstra 2024-12-04 13:56:03 +01:00
parent f469bc2ae4
commit 7ba933e989
3 changed files with 17 additions and 1 deletions

View file

@ -431,7 +431,7 @@ struct GitInputScheme : InputScheme
// If this is a local directory and no ref or revision is
// given, then allow the use of an unclean working tree.
if (!input.getRef() && !input.getRev() && repoInfo.isLocal)
repoInfo.workdirInfo = GitRepo::openRepo(repoInfo.url)->getWorkdirInfo();
repoInfo.workdirInfo = GitRepo::getCachedWorkdirInfo(repoInfo.url);
return repoInfo;
}