aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-07 17:24:36 +0000
committerGravatar Runxi Yu2026-06-07 17:24:36 +0000
commit0c0e1674f4b5c6862e9c472ba3b0fcd84c194fc4 (patch)
tree2b8e2667094938ae539985b71f51d559d9e077cb /internal/testgit
parentTODO: hash function transition (diff)
signatureNo signature
internal/testgit: Add -S to CommitTree
Diffstat (limited to 'internal/testgit')
-rw-r--r--internal/testgit/commit.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/testgit/commit.go b/internal/testgit/commit.go
index b1838e71..78a83e05 100644
--- a/internal/testgit/commit.go
+++ b/internal/testgit/commit.go
@@ -15,6 +15,10 @@ type CommitTreeOptions struct {
Committer Identity
AuthorDate string
CommitterDate string
+
+ // Sign requests a signed commit via git commit-tree -S,
+ // using the gpg.format and user.signingkey configured on the repo.
+ Sign bool
}
// CommitTree creates a commit object from a tree and optional parents,
@@ -34,6 +38,10 @@ func (repo *Repo) CommitTree(
args = append(args, "-p", parent.String())
}
+ if opts.Sign {
+ args = append(args, "-S")
+ }
+
args = append(args, "-m", opts.Message, "--end-of-options", tree.String())
cmd := repo.command(tb, "git", args...)