1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-14 13:01:05 +01:00

Merge pull request #14368 from NixOS/keep-tarball-cache-open

Move getTarballCache() into fetchers::Settings
This commit is contained in:
Eelco Dolstra 2025-11-10 17:18:01 +00:00 committed by GitHub
commit 070e8ee590
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 29 additions and 13 deletions

View file

@ -1328,13 +1328,18 @@ std::vector<std::tuple<GitRepoImpl::Submodule, Hash>> GitRepoImpl::getSubmodules
return result;
}
ref<GitRepo> getTarballCache()
{
static auto repoDir = std::filesystem::path(getCacheDir()) / "tarball-cache";
namespace fetchers {
return GitRepo::openRepo(repoDir, true, true);
ref<GitRepo> Settings::getTarballCache() const
{
auto tarballCache(_tarballCache.lock());
if (!*tarballCache)
*tarballCache = GitRepo::openRepo(std::filesystem::path(getCacheDir()) / "tarball-cache", true, true);
return ref<GitRepo>(*tarballCache);
}
} // namespace fetchers
GitRepo::WorkdirInfo GitRepo::getCachedWorkdirInfo(const std::filesystem::path & path)
{
static Sync<std::map<std::filesystem::path, WorkdirInfo>> _cache;