From 23debf3af12ad7c447055256dd27fa41cf232d80 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2026 19:24:56 +0800 Subject: [PATCH] fix(server): honor configured commit signing (#3976) Paseo forced signing off for commits created through the app and squash merges. Let Git apply the user's configured policy; the existing command timeout still bounds interactive signer waits. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> --- .../server/src/utils/checkout-git.test.ts | 23 +++++++++++++++++++ packages/server/src/utils/checkout-git.ts | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/checkout-git.test.ts b/packages/server/src/utils/checkout-git.test.ts index 182cc7ce98..45c0aff7c1 100644 --- a/packages/server/src/utils/checkout-git.test.ts +++ b/packages/server/src/utils/checkout-git.test.ts @@ -521,6 +521,14 @@ describe("checkout git utilities", () => { expect(message).toBe("update file"); }); + it("honors commit signing configuration", async () => { + execFileSync("git", ["config", "commit.gpgsign", "true"], { cwd: repoDir }); + execFileSync("git", ["config", "gpg.program", process.execPath], { cwd: repoDir }); + writeFileSync(join(repoDir, "file.txt"), "signed\n"); + + await expect(commitAll(repoDir, "signed update")).rejects.toThrow("failed to sign the data"); + }); + it("includes both paths for a staged rename in structured diffs", async () => { execFileSync("git", ["mv", "file.txt", "renamed.txt"], { cwd: repoDir }); @@ -3530,6 +3538,21 @@ const x = 1; ); }); + it("honors commit signing configuration for squash merges", async () => { + execFileSync("git", ["checkout", "-b", "feature"], { cwd: repoDir }); + writeFileSync(join(repoDir, "feature.txt"), "feature\n"); + execFileSync("git", ["add", "feature.txt"], { cwd: repoDir }); + execFileSync("git", ["-c", "commit.gpgsign=false", "commit", "-m", "feature commit"], { + cwd: repoDir, + }); + execFileSync("git", ["config", "commit.gpgsign", "true"], { cwd: repoDir }); + execFileSync("git", ["config", "gpg.program", process.execPath], { cwd: repoDir }); + + await expect(mergeToBase(repoDir, { baseRef: "main", mode: "squash" })).rejects.toThrow( + "failed to sign the data", + ); + }); + it("uses stored baseRefName for Paseo worktrees (no heuristics)", async () => { // Create a non-default base branch with a unique commit. execFileSync("git", ["checkout", "-b", "develop"], { cwd: repoDir }); diff --git a/packages/server/src/utils/checkout-git.ts b/packages/server/src/utils/checkout-git.ts index c0ae12f8f0..d20a41616e 100644 --- a/packages/server/src/utils/checkout-git.ts +++ b/packages/server/src/utils/checkout-git.ts @@ -3387,7 +3387,7 @@ export async function commitChanges( if (options.addAll ?? true) { await runGitCommand(["add", "-A"], { cwd, timeout: 120_000 }); } - await runGitCommand(["-c", "commit.gpgsign=false", "commit", "-m", options.message], { + await runGitCommand(["commit", "-m", options.message], { cwd, timeout: 120_000, }); @@ -3565,7 +3565,7 @@ export async function mergeToBase( }); const message = options.commitMessage ?? `Squash merge ${currentBranch} into ${normalizedBaseRef}`; - await runGitCommand(["-c", "commit.gpgsign=false", "commit", "-m", message], { + await runGitCommand(["commit", "-m", message], { cwd: operationCwd, timeout: 120_000, });