Never sign byre's own commits on the server

This commit is contained in:
Ian Gulliver
2026-10-21 14:24:34 -07:00
parent a7cfd91399
commit 35683e1114
4 changed files with 9 additions and 14 deletions
-9
View File
@@ -4,7 +4,6 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
@@ -13,20 +12,12 @@ func signingCmd(args []string) {
usage()
}
checkout := args[0]
common := gitOut(checkout, "rev-parse", "--path-format=absolute", "--git-common-dir")
if gitOut(checkout, "rev-parse", "--path-format=absolute", "--git-dir") != common {
fatal("checkout is a linked worktree; run byre signing on its main checkout", "checkout", checkout)
}
unsigned := filepath.Join(common, "unsigned.gitconfig")
gitOut(checkout, "config", "commit.gpgsign", "true")
gitOut(checkout, "config", "--file", unsigned, "commit.gpgsign", "false")
gitOut(checkout, "config", "includeIf.gitdir:"+filepath.Join(common, "worktrees")+"/**.path", "unsigned.gitconfig")
signing := gitOut(checkout, "config", "--type=bool", "--get", "commit.gpgsign")
if signing != "true" {
fatal("checkout's commit.gpgsign is not true after setting it", "checkout", checkout, "value", signing)
}
fmt.Printf("%s: commit.gpgsign %s\n", checkout, signing)
fmt.Printf("%s/worktrees/*: commit.gpgsign %s\n", common, gitOut(checkout, "config", "--file", unsigned, "--type=bool", "--get", "commit.gpgsign"))
}
func gitOut(dir string, args ...string) string {