diff --git a/packages/runner/src/conflict-step.ts b/packages/runner/src/conflict-step.ts index f34c6d4c..d1c06df8 100644 --- a/packages/runner/src/conflict-step.ts +++ b/packages/runner/src/conflict-step.ts @@ -28,7 +28,7 @@ import { import { settings, keyPrefix, type Db } from "@peppa/db"; import { asIs, m } from "@peppa/shared/i18n"; import { requestRebase } from "./flow.ts"; -import { git } from "./git.ts"; +import { credentialHelper, run } from "./git.ts"; import { resolveTaskById } from "./sessions.ts"; type Log = (m: string) => void; @@ -74,6 +74,16 @@ export function setConflictFilesLister(f: FilesLister | null): void { filesLister = f ?? gitConflictFiles; } +/** A git call bounded in time: the list of files must never hold the escalation (CI, a slow Gitea). */ +const GIT_TIMEOUT_MS = 20_000; +const git = (cwd: string, ...args: string[]) => + run("git", ["-c", "credential.helper=", "-c", `credential.helper=${credentialHelper()}`, ...args], { + cwd, + timeout: GIT_TIMEOUT_MS, + killSignal: "SIGKILL", + env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }, + }); + /** * The files that conflict: fetch both heads into the project's working copy (objects and * FETCH_HEAD only, the working tree is untouched) and `git merge-tree` them. Null — unknown.