Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶ added in v14.1.0
type Error struct {
// contains filtered or unexported fields
}
Error reports an error in git update-ref
type PreReceiveError ¶ added in v14.1.0
type PreReceiveError struct {
Message string
}
PreReceiveError contains an error message for a git pre-receive failure
func (PreReceiveError) Error ¶ added in v14.1.0
func (e PreReceiveError) Error() string
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater wraps a `git update-ref --stdin` process, presenting an interface that allows references to be easily updated in bulk. It is not suitable for concurrent use.
func New ¶
func New(ctx context.Context, conf config.Cfg, repo git.RepositoryExecutor, opts ...UpdaterOpt) (*Updater, error)
New returns a new bulk updater, wrapping a `git update-ref` process. Call the various methods to enqueue updates, then call Wait() to attempt to apply all the updates at once.
It is important that ctx gets canceled somewhere. If it doesn't, the process spawned by New() may never terminate.
func (*Updater) Create ¶
func (u *Updater) Create(reference git.ReferenceName, value string) error
Create commands the reference to be created with the sha specified in value
func (*Updater) Delete ¶
func (u *Updater) Delete(reference git.ReferenceName) error
Delete commands the reference to be removed from the repository
func (*Updater) Prepare ¶
Prepare prepares the reference transaction by locking all references and determining their current values. The updates are not yet committed and will be rolled back in case there is no call to `Wait()`. This call is optional.
type UpdaterOpt ¶
type UpdaterOpt func(*updaterConfig)
UpdaterOpt is a type representing options for the Updater.
func WithDisabledTransactions ¶
func WithDisabledTransactions() UpdaterOpt
WithDisabledTransactions disables hooks such that no reference-transactions are used for the updater.
type UpdaterWithHooks ¶ added in v14.1.0
type UpdaterWithHooks struct {
// contains filtered or unexported fields
}
UpdaterWithHooks updates a ref with Git hooks.
func NewUpdaterWithHooks ¶ added in v14.1.0
func NewUpdaterWithHooks( cfg config.Cfg, hookManager hook.Manager, gitCmdFactory git.CommandFactory, catfileCache catfile.Cache, ) *UpdaterWithHooks
NewUpdaterWithHooks creates a new instance of a struct that will update a Git reference.
func (*UpdaterWithHooks) UpdateReference ¶ added in v14.1.0
func (u *UpdaterWithHooks) UpdateReference( ctx context.Context, repo *gitalypb.Repository, user *gitalypb.User, reference git.ReferenceName, newrev, oldrev git.ObjectID, pushOptions ...string, ) error
UpdateReference updates a branch with a given commit ID using the Git hooks