Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Read the shared Git directory without an = flag literal
garrytan494ab9711505
diff --git a/src/core/hardened-git.ts b/src/core/hardened-git.tsindex c55b212fd7..50092d59ad 100644--- a/src/core/hardened-git.ts+++ b/src/core/hardened-git.ts@@ -106,7 +106,7 @@ const LOG_SHAPES: ReadonlyArray<readonly string[]> = [REASON_LOG_OPTIONS, HISTOR* listed here refuses.*/const ALLOWED_OPTIONS: ReadonlyMap<string, ReadonlySet<string>> = new Map([- ['rev-parse', new Set(['--show-toplevel', '--absolute-git-dir', '--git-common-dir', '--path-format=absolute', '--verify', '--quiet', '--show-object-format'])],+ ['rev-parse', new Set(['--show-toplevel', '--absolute-git-dir', '--git-common-dir', '--verify', '--quiet', '--show-object-format'])],['ls-files', new Set(['-s', '--stage', '--eol', '-z', '--cached', '--others', '--exclude-standard'])],['ls-tree', new Set(['-r', '-l', '-z', '--full-tree'])],['cat-file', new Set(['--batch', '--batch-check'])],diff --git a/src/core/url-source-origin.ts b/src/core/url-source-origin.tsindex 5b6fe49f50..4398105e7b 100644--- a/src/core/url-source-origin.ts+++ b/src/core/url-source-origin.ts@@ -119,9 +119,9 @@ function lockDownGaps(root: string): string[] {* `written` once every key is in the file.*/function lockDownCheckout(root: string, progress: { state: 'none' | 'started' | 'written' | 'done' }): void {- const commonDir = hardenedGitSync(root, ['rev-parse', '--path-format=absolute', '--git-common-dir'], GIT_LIMITS);+ const commonDir = hardenedGitSync(root, ['rev-parse', '--git-common-dir'], GIT_LIMITS);if (!commonDir.ok) throw new Error(`Git could not locate the repository of ${root}.`);- const file = join(commonDir.stdout.toString('utf8').replace(/\n$/, ''), 'config');+ const file = join(resolve(root, commonDir.stdout.toString('utf8').replace(/\n$/, '')), 'config');progress.state = 'started';for (const [key, value] of LOCK_DOWN)execFileSync('git', ['config', '--file', file, key, value], { cwd: dirname(file), env: hardenedGitEnvironment(), stdio: 'pipe', timeout: GIT_LIMITS.timeoutMs });