From b433e818fcdcf4f74d76bb05243c6d3a2bbadca1 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Fri, 25 Sep 2026 09:45:48 +0000 Subject: [PATCH] test(storage): pin the publish gate for cone and sparse-index checkouts (#3374) isWorkingTreePristine already rejects every sparse mode, because each one marks left-out entries skip-worktree and `git ls-files -v` expands a sparse index. Only no-cone was tested; cover cone and cone with a sparse index too. Co-Authored-By: Claude Opus 5.5 (1M context) --- gitnexus/test/unit/git-utils.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gitnexus/test/unit/git-utils.test.ts b/gitnexus/test/unit/git-utils.test.ts index ac7286d18..b1e00d727 100644 --- a/gitnexus/test/unit/git-utils.test.ts +++ b/gitnexus/test/unit/git-utils.test.ts @@ -1198,11 +1198,17 @@ describe('isWorkingTreePristine', () => { }, ); - it('is false in a sparse checkout that leaves committed files out', async () => { + // Every sparse mode marks the left-out entries skip-worktree, which is what + // the check reads; a sparse index still expands for `git ls-files -v`. + it.each([ + ['no-cone', ['set', '--no-cone', '/a.ts']], + ['cone', ['set', '--cone']], + ['cone with a sparse index', ['set', '--cone', '--sparse-index']], + ])('is false in a %s sparse checkout that leaves committed files out', async (_mode, args) => { const { isWorkingTreePristine } = await import('../../src/storage/git.js'); const repo = makeCommittedRepo(); try { - gitIn(repo, 'sparse-checkout', 'set', '--no-cone', '/a.ts'); + gitIn(repo, 'sparse-checkout', ...args); expect(fs.existsSync(path.join(repo, 'lib', 'b.ts'))).toBe(false); expect(isWorkingTreePristine(repo)).toBe(false);