mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-24 10:12:44 +00:00
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:
@@ -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 });
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user