gitx

package
v0.0.0-...-bec1191 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package git provides rebuilder-specific git abstractions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRemoteNotTracked is returned when a reuse is attempted but the remote does not match.
	ErrRemoteNotTracked = errors.New("existing repository does not track desired remote")
)

Functions

func Reuse

func Reuse(ctx context.Context, s storage.Storer, fs billy.Filesystem, opt *git.CloneOptions) (*git.Repository, error)

Reuse reuses the existing git repo in Storer and Filesystem.

Types

type Cache

type Cache struct {
	// IDClient is the HTTP client to use to access the cache service.
	IDClient *http.Client
	// APIClient is the HTTP client to use to access the underlying cache storage.
	APIClient *http.Client
	// URL is the address of the cache service.
	*url.URL
	// DefaultFreshness is the freshness bound to use if none is provided.
	DefaultFreshness time.Time
}

Cache is an interface abstracting the rebuilder git-cache service.

func (Cache) Clone

func (c Cache) Clone(ctx context.Context, s storage.Storer, fs billy.Filesystem, opt *git.CloneOptions) (*git.Repository, error)

Clone provides an interface to clone a git repo using the GitCache.

func (c Cache) GetLink(repo string, contains time.Time) (uri string, err error)

GetLink returns a GCS link to the cached repo resource.

type CloneFunc

type CloneFunc func(context.Context, storage.Storer, billy.Filesystem, *git.CloneOptions) (*git.Repository, error)

CloneFunc defines an interface for cloning a git repo.

var Clone CloneFunc = git.CloneContext

Clone performs a normal clone operation.

type Storer

type Storer struct {
	storage.Storer
	// contains filtered or unexported fields
}

Storer augments go-git's Storer to provide the capability to re-initialize the underlying state.

func NewStorer

func NewStorer(init func() storage.Storer) *Storer

NewStorer creates and initializes a new Storer.

func (*Storer) Reset

func (s *Storer) Reset()

Reset recreates the underlying Storer from the callback.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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