Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
P1.5a: the info/exclude and ls-files git spawns run under gitChildEnv() (git-env-guard)
garrytana198fb4c74c2
diff --git a/src/core/bootstrap/verify.ts b/src/core/bootstrap/verify.tsindex 311ab0e05b..932990948b 100644--- a/src/core/bootstrap/verify.ts+++ b/src/core/bootstrap/verify.ts@@ -397,7 +397,7 @@ export function checkDenyGlobs(ws: string): VerifyCheck {// stamped before the exclude rule, a concurrent run's lock) is not a finding:// `sources push` excludes it. One in the INDEX is, with `git rm --cached` as the fix.const indexed = new Set(execFileSync('git', ['-C', ws, 'ls-files', '--cached', '-z'], {- stdio: ['ignore', 'pipe', 'ignore'], timeout: 15_000, maxBuffer: 16 * 1024 * 1024,+ stdio: ['ignore', 'pipe', 'ignore'], timeout: 15_000, maxBuffer: 16 * 1024 * 1024, env: gitChildEnv(),}).toString().split('\0').filter((f) => f.length > 0));const findings = matches.filter((f) => indexed.has(f) || !OWNERSHIP_DENY_GLOBS.some((g) => matchesGlob(g, f)));if (findings.length > 0) {diff --git a/src/core/persistence/physical-root-record.ts b/src/core/persistence/physical-root-record.tsindex 975a2722f9..1d1193c303 100644--- a/src/core/persistence/physical-root-record.ts+++ b/src/core/persistence/physical-root-record.ts@@ -3,6 +3,7 @@ import { execFileSync } from 'node:child_process';import { appendFileSync, closeSync, constants, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from 'node:fs';import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';import { OperationError } from '../ops/contract.ts';+import { gitChildEnv } from '../git-env.ts';import { flushDirectory } from '../fs-durable.ts';import { digest, sha256 } from './digest.ts';import { canonicalFilesystemPath } from './root-registry.ts';@@ -25,7 +26,7 @@ export function excludeOwnershipMarkers(directories: readonly string[]): void {try {if (!statSync(directory).isDirectory()) continue;const path = execFileSync('git', ['-C', directory, 'rev-parse', '--git-path', 'info/exclude'],- { stdio: ['ignore', 'pipe', 'ignore'], timeout: 10_000 }).toString().trim();+ { stdio: ['ignore', 'pipe', 'ignore'], timeout: 10_000, env: gitChildEnv() }).toString().trim();if (!path) continue;exclude = resolve(directory, path);} catch { continue; }