updateref

package
v16.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomHookError

type CustomHookError struct {
	// contains filtered or unexported fields
}

CustomHookError contains an error message when executing a custom hook.

func (CustomHookError) Error

func (e CustomHookError) Error() string

Error returns an error message.

func (CustomHookError) Proto

Proto returns the Protobuf representation of this error.

func (CustomHookError) Unwrap

func (e CustomHookError) Unwrap() error

Unwrap will return the embedded error.

type Error

type Error struct {
	// Reference is the name of the reference that would have been updated.
	Reference git.ReferenceName
	// OldOID and NewOID are the expected object IDs previous to and after the update if it
	// would have succeeded.
	OldOID, NewOID git.ObjectID
	// Cause is an actual cause of the error.
	Cause error
}

Error reports an error in git update-ref

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap returns Cause.

type UpdaterWithHooks

type UpdaterWithHooks struct {
	// contains filtered or unexported fields
}

UpdaterWithHooks updates a ref with Git hooks.

func NewUpdaterWithHooks

func NewUpdaterWithHooks(
	cfg config.Cfg,
	logger log.Logger,
	locator storage.Locator,
	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

func (u *UpdaterWithHooks) UpdateReference(
	ctx context.Context,
	repoProto *gitalypb.Repository,
	user *gitalypb.User,
	quarantineDir *quarantine.Dir,
	reference git.ReferenceName,
	newrev, oldrev git.ObjectID,
	pushOptions ...string,
) error

UpdateReference updates a branch with a given commit ID using the Git hooks. If a quarantine directory is given, then the pre-receive, update and reference-transaction hook will be invoked with the quarantined repository as returned by the quarantine structure. If these hooks succeed, quarantined objects will be migrated and all subsequent hooks are executed via the unquarantined repository.

Jump to

Keyboard shortcuts

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