diff options
author | Toon Claes <toon@gitlab.com> | 2021-01-20 17:47:59 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2021-02-17 18:12:20 +0300 |
commit | 0ff1d165de464430f09cd8b00cf54c9f71273980 (patch) | |
tree | 411caf7e7891f5e5610258001c34cf11d74aa2d5 /internal/git2go | |
parent | 8f979d5ed091a28419842ad62bb9137a73296c4e (diff) |
Implement UserCherryPick in Go
This implements the `UserCherryPick` command in Go. It uses
`gitaly-git2go` to call `func (*Repository) Cherrypick`.
This feature is behind a feature flag and is disabled by default. The
Ruby implementation is kept (for now) and is the default.
The feature flag roll-out issue:
https://gitlab.com/gitlab-org/gitaly/-/issues/3281
Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/3071
Diffstat (limited to 'internal/git2go')
-rw-r--r-- | internal/git2go/cherry_pick.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/git2go/cherry_pick.go b/internal/git2go/cherry_pick.go new file mode 100644 index 000000000..71c7c6f06 --- /dev/null +++ b/internal/git2go/cherry_pick.go @@ -0,0 +1,33 @@ +package git2go + +import ( + "context" + "time" + + "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" +) + +// CherryPickCommand contains parameters to perform a cherry pick. +type CherryPickCommand struct { + // Repository is the path where to execute the cherry pick. + Repository string + // AuthorName is the author name for the resulting commit. + AuthorName string + // AuthorMail is the author mail for the resulting commit. + AuthorMail string + // AuthorDate is the author date of revert commit. + AuthorDate time.Time + // Message is the message to be used for the resulting commit. + Message string + // Ours is the commit that the revert is applied to. + Ours string + // Commit is the commit that is to be picked. + Commit string + // Mainline is the parent to be considered the mainline + Mainline uint +} + +// Run performs a cherry pick via gitaly-git2go. +func (m CherryPickCommand) Run(ctx context.Context, cfg config.Cfg) (string, error) { + return runWithGob(ctx, cfg, "cherry-pick", m) +} |