@@ -67,14 +67,19 @@ describe("shared project versions", () => {
6767 test ( "keeps the version store invisible to an enclosing Git worktree" , async ( ) => {
6868 const root = await temporaryDirectory ( ) ;
6969 const configPath = join ( root , "agents.yaml" ) ;
70+ // Git hooks export repository-local variables; this fixture owns a different repository.
71+ const { stdout : localEnvironmentKeys } = await execFileAsync ( "git" , [ "rev-parse" , "--local-env-vars" ] ) ;
72+ const env = { ...process . env } ;
73+ for ( const key of localEnvironmentKeys . trim ( ) . split ( "\n" ) ) delete env [ key ] ;
74+ const gitOptions = { cwd : root , env } ;
7075 await writeFile ( configPath , projectYaml ( "Initial" ) ) ;
71- await execFileAsync ( "git" , [ "init" , "--initial-branch" , "main" ] , { cwd : root } ) ;
72- await execFileAsync ( "git" , [ "add" , "--" , "agents.yaml" ] , { cwd : root } ) ;
73- const before = await execFileAsync ( "git" , [ "status" , "--porcelain=v1" ] , { cwd : root } ) ;
76+ await execFileAsync ( "git" , [ "init" , "--initial-branch" , "main" ] , gitOptions ) ;
77+ await execFileAsync ( "git" , [ "add" , "--" , "agents.yaml" ] , gitOptions ) ;
78+ const before = await execFileAsync ( "git" , [ "status" , "--porcelain=v1" ] , gitOptions ) ;
7479
7580 await enableProjectVersioning ( configPath , "Baseline" ) ;
7681
77- const after = await execFileAsync ( "git" , [ "status" , "--porcelain=v1" ] , { cwd : root } ) ;
82+ const after = await execFileAsync ( "git" , [ "status" , "--porcelain=v1" ] , gitOptions ) ;
7883 expect ( after . stdout ) . toBe ( before . stdout ) ;
7984 expect ( after . stdout ) . not . toContain ( ".openagentpack" ) ;
8085 } ) ;
0 commit comments