@@ -91,6 +91,30 @@ test('readChangedFiles unions staged and unstaged so a net diff cannot hide a fi
9191
9292const 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.
96120const ALL_SCRIPTS : Record < string , string > = (
0 commit comments