Skip to content

Commit 93f8ae0

Browse files
authored
chore: ignore host-local workspace artifacts (#1942)
1 parent 81409f1 commit 93f8ae0

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ dist/
99
coverage/
1010
.tmp/
1111
.DS_Store
12+
13+
# Host-local Codex state and embedded worktree clones
14+
/.codex/
15+
/.worktrees/
16+
1217
__pycache__/
1318
*.pyc
1419
*.log

‎scripts/check-affected/run.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ test('readChangedFiles unions staged and unstaged so a net diff cannot hide a fi
9191

9292
const repoRoot = path.resolve(import.meta.dirname, '../..');
9393

94+
test('readChangedFiles excludes repository-owned host-local workspace roots', () => {
95+
const dir = makeRepo();
96+
try {
97+
fs.copyFileSync(path.join(repoRoot, '.gitignore'), path.join(dir, '.gitignore'));
98+
fs.writeFileSync(path.join(dir, 'seed.ts'), 'export const seed = true;\n');
99+
git(dir, 'add', '.gitignore', 'seed.ts');
100+
git(dir, 'commit', '-q', '-m', 'base');
101+
const base = runCmdSync('git', ['rev-parse', 'HEAD'], { cwd: dir }).stdout.trim();
102+
103+
fs.mkdirSync(path.join(dir, '.codex'), { recursive: true });
104+
fs.mkdirSync(path.join(dir, '.worktrees', 'embedded-clone'), { recursive: true });
105+
fs.writeFileSync(path.join(dir, '.codex', 'config.local.toml'), 'model = "local"\n');
106+
fs.writeFileSync(
107+
path.join(dir, '.worktrees', 'embedded-clone', 'package.json'),
108+
'{"private":true}\n',
109+
);
110+
fs.writeFileSync(path.join(dir, 'untracked.ts'), 'export const visible = true;\n');
111+
112+
assert.deepEqual(readChangedFiles(base, 'HEAD', dir), ['untracked.ts']);
113+
} finally {
114+
fs.rmSync(dir, { recursive: true, force: true });
115+
}
116+
});
117+
94118
// The real package scripts: a fixture map has to be hand-extended for every new
95119
// gate, which is the drift the registry exists to remove.
96120
const ALL_SCRIPTS: Record<string, string> = (

0 commit comments

Comments
 (0)