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) <noreply@anthropic.com>
This commit is contained in:
Gergo Magyar 2026-09-25 09:45:48 +00:00
parent 11acf84239
commit b433e818fc

View file

@ -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);