File: revert.go

package info (click to toggle)
gitlab-shell 14.35.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,652 kB
  • sloc: ruby: 1,129; makefile: 583; sql: 391; sh: 384
file content (38 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package git2go

import (
	"context"
	"time"

	"gitlab.com/gitlab-org/gitaly/v16/internal/git"
	"gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage"
)

// RevertCommand contains parameters required to execute a revert via gitaly-git2go.
type RevertCommand struct {
	// Repository is the path to execute the revert in.
	Repository string
	// AuthorName is the author name of revert commit.
	AuthorName string
	// AuthorMail is the author mail of revert commit.
	AuthorMail string
	// AuthorDate is the author date of revert commit.
	AuthorDate time.Time
	// Message is the message to be used for the revert commit.
	Message string
	// Ours is the commit that the revert is applied to.
	Ours string
	// Revert is the commit to be reverted.
	Revert string
	// Mainline is the parent to be considered the mainline
	Mainline uint
	// SigningKey is a path to the key to sign commit using OpenPGP
	SigningKey string
}

// Revert reverts a commit via gitaly-git2go.
func (b *Executor) Revert(ctx context.Context, repo storage.Repository, r RevertCommand) (git.ObjectID, error) {
	r.SigningKey = b.signingKey

	return b.runWithGob(ctx, repo, "revert", r)
}