Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.