git

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package git implements tools for transferring git repositories to/from OCI compliant registiries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FromOCI

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

FromOCI represents an OCI to git sync action.

func NewFromOCI

func NewFromOCI(ctx context.Context, target oras.GraphTarget, desc ocispec.Descriptor, dstGitRemote string, syncOpts SyncOptions, cmdOpts *cmd.Options) (*FromOCI, error)

NewFromOCI returns a FromOCI object after validating git and/or git-lfs compatibility. Unlike NewToOCI, the base manifest descriptor is not optional.

func (*FromOCI) Cleanup

func (f *FromOCI) Cleanup() error

Cleanup cleans up any temporary files created during the FromOCI process.

func (*FromOCI) FetchBaseManifestConfig

func (s *FromOCI) FetchBaseManifestConfig(ctx context.Context) error

FetchBaseManifestConfig fetches the base sync manifest and config, populating the Original with the results or initializing it with empty fields.

func (*FromOCI) FetchLFSManifestConfig

func (s *FromOCI) FetchLFSManifestConfig(ctx context.Context, root ocispec.Descriptor, clean bool) (ocispec.Descriptor, error)

FetchLFSManifestConfig copies all predecessor manifests with the LFS manifest media type, returning a pointer to an OCI CAS storage containing the result of the copy.

func (*FromOCI) GetHeadRefs

func (f *FromOCI) GetHeadRefs() (map[string]oci.ReferenceInfo, error)

GetHeadRefs returns the ReferenceInfo for heads from the commit manifest's config.

func (*FromOCI) GetTagRefs

func (f *FromOCI) GetTagRefs() (map[string]oci.ReferenceInfo, error)

GetTagRefs returns the ReferenceInfo for tags from the commit manifest's config.

func (*FromOCI) RefList

func (f *FromOCI) RefList() ([]string, error)

RefList returns a list of all refences in the commit manifest's config, filtering out the commits they reference.

func (*FromOCI) Run

func (f *FromOCI) Run(ctx context.Context) ([]string, error)

Run updates a remote git repository by fetching changes from a commit manifest, pushes the changes to the remote git reference and returns a slice of all updated tag and head references.

type SyncOptions

type SyncOptions struct {
	Clean             bool
	UserAgent         string
	IntermediateDir   string
	IntermediateStore *file.Store // TODO: This is a duplicate of what's in OCIHelper, let's remove OCIHelper
	Cache             cache.ObjectCacher
}

SyncOptions modify git to OCI and OCI to git processes.

type ToOCI

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

ToOCI represents a git to OCI sync action.

func NewToOCI

func NewToOCI(ctx context.Context, target oras.GraphTarget, desc ocispec.Descriptor, srcGitRemote string, argRevList []string, syncOpts SyncOptions, cmdOpts *cmd.Options) (*ToOCI, error)

NewToOCI returns a ToOCI object after validating git and/or git-lfs compatibility. An existing base manifest descriptor is optional.

func (*ToOCI) Cleanup

func (t *ToOCI) Cleanup() error

Cleanup cleans up any temporary files created during the ToOCI process.

func (*ToOCI) FetchBaseManifestConfig

func (s *ToOCI) FetchBaseManifestConfig(ctx context.Context) error

FetchBaseManifestConfig fetches the base sync manifest and config, populating the Original with the results or initializing it with empty fields.

func (*ToOCI) FetchLFSManifestConfig

func (s *ToOCI) FetchLFSManifestConfig(ctx context.Context, root ocispec.Descriptor, clean bool) (ocispec.Descriptor, error)

FetchLFSManifestConfig copies all predecessor manifests with the LFS manifest media type, returning a pointer to an OCI CAS storage containing the result of the copy.

func (*ToOCI) Run

func (t *ToOCI) Run(ctx context.Context) (ocispec.Descriptor, error)

Run leverages git bundles to store a git repository in an OCI registry. The bundle is appended to the manifest identified by a tag in the target repository if a bundle is necessary.

Not all calls to ToOCI result in a new bundle. Sometimes we only need to update the references, which is done in the manifest config.

Directories

Path Synopsis
Package cache facilitates caching git and git-lfs objects.
Package cache facilitates caching git and git-lfs objects.
Package cmd facilitates execution of git and git-lfs commands.
Package cmd facilitates execution of git and git-lfs commands.
Package oci facilitates transferring of git and git-lfs OCI artifacts.
Package oci facilitates transferring of git and git-lfs OCI artifacts.

Jump to

Keyboard shortcuts

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