aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/testgit/commit.go')
-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...)