Skip to content

fix: use typed .env() method for git prompt suppression#649

Open
elliotllliu wants to merge 1 commit intovercel-labs:mainfrom
elliotllliu:fix/typed-git-prompt-suppression
Open

fix: use typed .env() method for git prompt suppression#649
elliotllliu wants to merge 1 commit intovercel-labs:mainfrom
elliotllliu:fix/typed-git-prompt-suppression

Conversation

@elliotllliu
Copy link
Contributor

Summary

Closes #618

The simpleGit() constructor receives an env property that is not part of the typed SimpleGitOptions interface, causing a TypeScript overload mismatch error.

Before

const git = simpleGit({
  timeout: { block: CLONE_TIMEOUT_MS },
  env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }, // ← not typed
});

After

const git = simpleGit({
  timeout: { block: CLONE_TIMEOUT_MS },
}).env('GIT_TERMINAL_PROMPT', '0'); // ← typed method

Notes

  • GIT_TERMINAL_PROMPT=0 still suppresses interactive prompts during clone
  • The .env() method is part of simple-git's public API and properly typed
  • This also fixes the pre-existing TypeScript compile error in src/git.ts

Testing

All 375 tests pass (1 pre-existing timeout in sync.test.ts unrelated to this change).

Replace the untyped `env` constructor option in `simpleGit()` with
the typed `.env()` method chain. The `env` property is not part of
simple-git's `SimpleGitOptions` interface, causing a TypeScript
overload mismatch.

Before (untyped):
  simpleGit({ timeout: ..., env: { GIT_TERMINAL_PROMPT: '0' } })

After (typed):
  simpleGit({ timeout: ... }).env('GIT_TERMINAL_PROMPT', '0')

`GIT_TERMINAL_PROMPT=0` still suppresses interactive prompts
during clone.

Closes vercel-labs#618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use a typed prompt-suppression path for simple-git clone

1 participant