squash commit signing

This commit is contained in:
Ian Gulliver
2026-10-18 22:27:31 -07:00
parent 959f844416
commit c85266afd7
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -226,7 +226,18 @@ func SquashCommit(repo, worktree, target, message string, env []string) (string,
return "", nil
}
return runEnv(repo, env, "commit-tree", lines[0], "-p", head, "-m", message)
args := []string{"commit-tree", lines[0], "-p", head, "-m", message}
sign, stderr, code, err := runCode(repo, nil, "config", "--type=bool", "--get", "commit.gpgsign")
if err != nil {
return "", err
}
if code != 0 && code != 1 {
return "", fmt.Errorf("git config --get commit.gpgsign: exit status %d: %s", code, stderr)
}
if sign == "true" {
args = append(args, "-S")
}
return runEnv(repo, env, args...)
}
const Remote = "origin"