updateref

package
v14.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 6 Imported by: 0

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

func (u *Updater) Prepare() error

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.

func (*Updater) Update

func (u *Updater) Update(reference git.ReferenceName, newvalue, oldvalue string) error

Update commands the reference to be updated to point at the sha specified in newvalue

func (*Updater) Wait

func (u *Updater) Wait() error

Wait applies the commands specified in other calls to the Updater

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL