Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/utils/__tests__/git-test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export function expectGitExecOptions(options: unknown, cwd?: string): void {
expect(options).toEqual(expect.objectContaining({
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'ignore'],
timeout: 5_000,
windowsHide: true,
...(cwd ? { cwd } : {})
}));
Expand Down
2 changes: 2 additions & 0 deletions src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface PersistentGitCache {

const DEFAULT_GIT_CACHE_TTL_SECONDS = 5;
const GIT_CACHE_SCHEMA_VERSION = 1 as const;
const GIT_COMMAND_TIMEOUT_MS = 5_000;

// In-process cache keeps cwd in the key; the persistent cache stores cwd once
// at the file level and keys entries by command.
Expand Down Expand Up @@ -331,6 +332,7 @@ export function runGitArgs(args: string[], context: RenderContext, cacheCommand?
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'ignore'],
env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' },
timeout: GIT_COMMAND_TIMEOUT_MS,
windowsHide: true,
...(cwd ? { cwd } : {})
}).trimEnd();
Expand Down