diff options
| author | 2026-06-07 17:42:06 +0000 | |
|---|---|---|
| committer | 2026-06-07 17:42:25 +0000 | |
| commit | 6ce114a9e285e94a244dda867c0b7c2585680f6c (patch) | |
| tree | ad53e6da4c583e4fb38890911caa26db5aee7f9f /internal/testgit | |
| parent | object/signed{,/commit}: Add (diff) | |
| signature | No signature | |
internal/testgit: Add -s to tag
Diffstat (limited to 'internal/testgit')
| -rw-r--r-- | internal/testgit/tag.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/testgit/tag.go b/internal/testgit/tag.go index 9aaac157..139edf77 100644 --- a/internal/testgit/tag.go +++ b/internal/testgit/tag.go @@ -12,6 +12,10 @@ type TagAnnotatedOptions struct { Message string Tagger Identity TaggerDate string + + // Sign requests a signed tag via git tag -s, + // using the gpg.format and user.signingkey configured on the repo. + Sign bool } // TagAnnotated creates an annotated tag object and returns its object ID. @@ -23,7 +27,14 @@ func (repo *Repo) TagAnnotated( ) (id.ObjectID, error) { tb.Helper() - cmd := repo.command(tb, "git", "tag", "-a", "-m", opts.Message, "--end-of-options", name, target.String()) + args := []string{"tag", "-a"} + if opts.Sign { + args = append(args, "-s") + } + + args = append(args, "-m", opts.Message, "--end-of-options", name, target.String()) + + cmd := repo.command(tb, "git", args...) if opts.Tagger.Name != "" { cmd.Env = setEnv(cmd.Env, "GIT_COMMITTER_NAME", opts.Tagger.Name) |
