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>
This commit is contained in:
paseo-bot[bot]
2026-08-28 19:24:56 +08:00
committed by GitHub
parent 25eb322ef7
commit 23debf3af1
2 changed files with 25 additions and 2 deletions
@@ -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 });
+2 -2
View File
@@ -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,
});