Documentation
¶
Overview ¶
Package refcomp provides utilities for comparing local and remote git references.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RefComparer ¶
type RefComparer interface {
// Compare resolves the status of a remote reference.
Compare(ctx context.Context, force bool, localName plumbing.ReferenceName, remoteName plumbing.ReferenceName) (RefPair, error)
}
RefComparer provides utilities for comparing local and remote references.
func NewCachedRefComparer ¶
func NewCachedRefComparer(local git.Repository, remote model.Modeler) RefComparer
NewCachedRefComparer initializes a RefComparer that caches all ref comparisons.
type RefPair ¶
type RefPair struct {
// Local is the local Git reference resolved from a [plumbing.ReferenceName].
Local *plumbing.Reference
// Remote is the remote Git reference resolved from a [plumbing.ReferenceName].
Remote *plumbing.Reference
// Status is the result of comparing [RefPair.Local] to [RefPair.Remote].
Status
// Layer is the remote OCI layer that contains the commit referenced by [RefPair.Local], if available.
Layer digest.Digest // only populated if (status ^ statusAddCommit)
}
RefPair represents the state of a local and remote reference and their differences.
type Status ¶
type Status uint8
Status represents the result of a reference comparison.
const ( // StatusDelete indicates a ref should be removed from the remote. StatusDelete Status = 1 << iota // StatusUpdateRef indicates a StatusUpdateRef should be updated in the remote. StatusUpdateRef // StatusAddCommit indicates the ref's commit object should be added to the remote. StatusAddCommit // StatusForce indicates a StatusForce update should be performed. StatusForce )
Click to show internal directories.
Click to hide internal directories.