gitx

package
v0.0.0-...-249644f Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 24 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 Clone

Clone performs a clone operation, using native git if available, otherwise falling back to go-git.

func CopyStorer

func CopyStorer(dst, src storage.Storer) error

CopyStorer copies all git data from src to dst storage. This includes objects, references, config, and shallow commits. NOTE: This is very slow for large repos. If possible, prefer copying the underlying metadata content to the underlying destination.

func GCPBasicAuth

func GCPBasicAuth(ctx context.Context) (transport.AuthMethod, error)

GCPBasicAuth returns an AuthMethod using a GCP access token from the default credential.

func IsSSMURL

func IsSSMURL(rawURL string) bool

IsSSMURL returns true if the URL refers to a GCP Secure Source Manager repo.

func NativeClone

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

NativeClone clones a git repository using the native `git` command. If the target storage is not OS-backed, the results are first staged on disk. Supports both filesystem.Storage and memory.Storage.

func NativeGitAvailable

func NativeGitAvailable() bool

NativeGitAvailable returns true if the native git command is available in PATH.

func Reuse

Reuse reuses the existing git repo in Storer and Filesystem.

Types

type CloneFunc

CloneFunc defines an interface for cloning a git repo.

type RepositoryOptions

type RepositoryOptions struct {
	Storer   storage.Storer
	Worktree billy.Filesystem
}

RepositoryOptions configures the storage and worktree for repositories.

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