diff --git a/src/resources/extensions/gsd/git-constants.ts b/src/resources/extensions/gsd/git-constants.ts new file mode 100644 index 000000000..7213798ca --- /dev/null +++ b/src/resources/extensions/gsd/git-constants.ts @@ -0,0 +1,11 @@ +/** + * Shared git constants used across git-service and native-git-bridge. + */ + +/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */ +export const GIT_NO_PROMPT_ENV = { + ...process.env, + GIT_TERMINAL_PROMPT: "0", + GIT_ASKPASS: "", + GIT_SVN_ID: "", +}; diff --git a/src/resources/extensions/gsd/git-service.ts b/src/resources/extensions/gsd/git-service.ts index cb0e6a5d1..97e39ef34 100644 --- a/src/resources/extensions/gsd/git-service.ts +++ b/src/resources/extensions/gsd/git-service.ts @@ -11,6 +11,7 @@ import { execFileSync, execSync } from "node:child_process"; import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { join } from "node:path"; +import { GIT_NO_PROMPT_ENV } from "./git-constants.js"; import { detectWorktreeName, @@ -254,13 +255,6 @@ export function writeIntegrationBranch(basePath: string, milestoneId: string, br // ─── Git Helper ──────────────────────────────────────────────────────────── -/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */ -const GIT_NO_PROMPT_ENV = { - ...process.env, - GIT_TERMINAL_PROMPT: "0", - GIT_ASKPASS: "", - GIT_SVN_ID: "", -}; /** * Strip git-svn noise from error messages. diff --git a/src/resources/extensions/gsd/native-git-bridge.ts b/src/resources/extensions/gsd/native-git-bridge.ts index 0ce89662b..dd0958d53 100644 --- a/src/resources/extensions/gsd/native-git-bridge.ts +++ b/src/resources/extensions/gsd/native-git-bridge.ts @@ -9,14 +9,7 @@ import { execSync, execFileSync } from "node:child_process"; import { existsSync, readFileSync, unlinkSync, rmSync } from "node:fs"; import { join } from "node:path"; import { GSDError, GSD_GIT_ERROR } from "./errors.js"; - -/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */ -const GIT_NO_PROMPT_ENV = { - ...process.env, - GIT_TERMINAL_PROMPT: "0", - GIT_ASKPASS: "", - GIT_SVN_ID: "", -}; +import { GIT_NO_PROMPT_ENV } from "./git-constants.js"; // Issue #453: keep auto-mode bookkeeping on the stable git CLI path unless a // caller explicitly opts into the native helper. @@ -160,6 +153,7 @@ function gitFileExec(basePath: string, args: string[], allowFailure = false): st cwd: basePath, stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8", + env: GIT_NO_PROMPT_ENV, }).trim(); } catch { if (allowFailure) return "";