From 0c0e1674f4b5c6862e9c472ba3b0fcd84c194fc4 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 7 Jun 2026 17:24:36 +0000 Subject: internal/testgit: Add -S to CommitTree --- internal/testgit/commit.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/testgit/commit.go') 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...) -- cgit v1.3.1-10-gc9f91