Documentation
¶
Overview ¶
Package git provides rebuilder-specific git abstractions.
Index ¶
- Variables
- func Clone(ctx context.Context, s storage.Storer, fs billy.Filesystem, ...) (*git.Repository, error)
- func CopyStorer(dst, src storage.Storer) error
- func GCPBasicAuth(ctx context.Context) (transport.AuthMethod, error)
- func IsSSMURL(rawURL string) bool
- func NativeClone(ctx context.Context, s storage.Storer, fs billy.Filesystem, ...) (*git.Repository, error)
- func NativeGitAvailable() bool
- func Reuse(ctx context.Context, s storage.Storer, fs billy.Filesystem, ...) (*git.Repository, error)
- type CloneFunc
- type RepositoryOptions
- type Storer
Constants ¶
This section is empty.
Variables ¶
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 ¶
func Clone(ctx context.Context, s storage.Storer, fs billy.Filesystem, opt *git.CloneOptions) (*git.Repository, error)
Clone performs a clone operation, using native git if available, otherwise falling back to go-git.
func CopyStorer ¶
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 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 ¶
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 CloneFunc ¶
type CloneFunc func(context.Context, storage.Storer, billy.Filesystem, *git.CloneOptions) (*git.Repository, error)
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.