From 28cd129a23bd20853d234bcb418864caea145112 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 6 May 2026 23:05:11 -0600 Subject: [PATCH] ref(builds-cacher): gate .git on client-provided unpacker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `.git` was pushed unconditionally into getSortedFormats's candidate ext list, while sibling unpacker formats (.tar.xz, .tar.zst, .zip, .7z) are gated on whether the caller's `formats` argument signals the client has the corresponding tool. Make `.git` consistent: only add it to the candidate list when formats includes 'git'. The default WEBI_FORMATS ('tar,exe,zip,xz, dmg') doesn't include git, so the change is a no-op for the current default. Clients that want git-source packages installed can pass `?formats=tar,exe,zip,xz,dmg,git` (or set the equivalent in a future client-side probe). For packages that have only a git-source asset (e.g. some vim plugins), the existing fallback to `packages[0]` still returns the git entry — behavior unchanged. The only observable change is for packages where both a binary and a git fallback exist for the same triplet: previously the git entry could win over the binary; now it wins only when the client opts in. --- _webi/builds-cacher.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_webi/builds-cacher.js b/_webi/builds-cacher.js index a0c8da1..f7da9b4 100644 --- a/_webi/builds-cacher.js +++ b/_webi/builds-cacher.js @@ -557,7 +557,10 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) { exts.push('.gz'); exts.push('.sh'); } - exts.push('.git'); + let hasGit = formats.includes('git') || formats.includes('.git'); + if (hasGit) { + exts.push('.git'); + } // Fallbacks // (we include everything to bubble an extract error over not found)