diff --git a/packages/testkit/src/mock-gitea.ts b/packages/testkit/src/mock-gitea.ts index 026c6423..bfde5b83 100644 --- a/packages/testkit/src/mock-gitea.ts +++ b/packages/testkit/src/mock-gitea.ts @@ -478,7 +478,8 @@ export class MockGitea { if (method === "PUT" && current !== body.sha) return { status: 409, body: { message: `sha does not match [given: ${body.sha}, expected: ${current}]` } }; const blob = git(["hash-object", "-w", "--stdin"], undefined, Buffer.from(String(body.content), "base64").toString("utf8")); const index = join(mkdtempSync(join(tmpdir(), "mock-gitea-idx-")), "index"); - const env = { GIT_INDEX_FILE: index, GIT_AUTHOR_NAME: String(body.author?.name ?? me.login), GIT_AUTHOR_EMAIL: String(body.author?.email ?? "mock@example.invalid"), GIT_COMMITTER_NAME: me.login, GIT_COMMITTER_EMAIL: "mock@example.invalid" }; + const author = (body.author ?? {}) as { name?: string; email?: string }; + const env = { GIT_INDEX_FILE: index, GIT_AUTHOR_NAME: String(author.name ?? me.login), GIT_AUTHOR_EMAIL: String(author.email ?? "mock@example.invalid"), GIT_COMMITTER_NAME: me.login, GIT_COMMITTER_EMAIL: "mock@example.invalid" }; if (parent) git(["read-tree", parent], env); git(["update-index", "--add", "--cacheinfo", `100644,${blob},${path}`], env); const tree = git(["write-tree"], env);