From 0ffe83aa14cbc6d663fb8e12ca2950581101f8ee Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 15 Dec 2025 22:12:08 +0300 Subject: [PATCH] libfetchers: Bump tarball-cache version to v2 Unfortunately previous tarball caches had loose objects written to them and subsequent switch to thin packfiles. This results in possibly broken thin packfiles when the loose objects backend is disabled. Thin packfiles do not necessarily contain the whole closure of objects. When packfilesOnly is true we end up with an inconsistent state where a tree lives in a packfiles which refers to a blob in the loose objects backend. In the future we might want to nuke old cache directories and repack the tarball cache. --- src/libfetchers/git-utils.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 068b620ad..c729f98d3 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -1430,7 +1430,11 @@ namespace fetchers { ref Settings::getTarballCache() const { - static auto repoDir = std::filesystem::path(getCacheDir()) / "tarball-cache"; + /* v1: Had either only loose objects or thin packfiles referring to loose objects + * v2: Must have only packfiles with no loose objects. Should get repacked periodically + * for optimal packfiles. + */ + static auto repoDir = std::filesystem::path(getCacheDir()) / "tarball-cache-v2"; return GitRepo::openRepo(repoDir, {.create = true, .bare = true, .packfilesOnly = true}); }