File: rebase.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 (42 lines) | stat: -rw-r--r-- 1,696 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
39
40
41
42
package git2go

import (
	"context"

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

// RebaseCommand contains parameters to rebase a branch.
type RebaseCommand struct {
	// Repository is the path to execute rebase in.
	Repository string
	// Committer contains the the committer signature.
	Committer Signature
	// BranchName is the branch that is rebased. Deprecated, can be removed in the next release.
	BranchName string
	// UpstreamRevision is the revision where the branch is rebased onto. Deprecated, can be
	// removed in the next release.
	UpstreamRevision string
	// CommitID is the object ID of the commit that shall be rebased. Deprecates BranchName.
	CommitID git.ObjectID
	// UpstreamCommitID is the object ID of the commit which is considered to be the
	// upstream branch. This parameter determines both the commit onto which we're
	// about to rebase, which is the merge base of the upstream commit and rebased
	// commit, and which commits should be rebased, which is the commit range
	// upstream..commit. Deprecates the UpstreamRevision.
	UpstreamCommitID git.ObjectID
	// SkipEmptyCommits will cause commits which have already been applied on the target branch
	// and which are thus empty to be skipped. If unset, empty commits will cause the rebase to
	// fail.
	SkipEmptyCommits bool
	// SigningKey is a path to the key to sign commit using OpenPGP
	SigningKey string
}

// Rebase performs the rebase via gitaly-git2go
func (b *Executor) Rebase(ctx context.Context, repo storage.Repository, r RebaseCommand) (git.ObjectID, error) {
	r.SigningKey = b.signingKey

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