gitsrc

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRepositoryRef reports a repository URL outside the public HTTPS grammar.
	ErrInvalidRepositoryRef = errors.New("gitsrc: invalid repository URL")
	// ErrRepositoryDestinationBlocked reports a repository whose resolved addresses violate policy.
	ErrRepositoryDestinationBlocked = errors.New("gitsrc: repository destination blocked")
	// ErrRepositoryTooLarge reports that the checked-out repository exceeds the archive content budget.
	ErrRepositoryTooLarge = errors.New("gitsrc: repository exceeds max uncompressed size")
	// ErrRepositoryTooManyFiles reports that the checked-out repository exceeds the archive entry budget.
	ErrRepositoryTooManyFiles = errors.New("gitsrc: repository exceeds max file count")
)
View Source
var ErrGitUnavailable = errors.New("gitsrc: git executable unavailable")

ErrGitUnavailable reports that the required git executable cannot be found.

View Source
var ErrGitVersionUnsupported = errors.New("gitsrc: Git 2.37 or newer is required")

ErrGitVersionUnsupported reports a Git binary too old to pin approved DNS answers.

Functions

func ValidateRepositoryRef

func ValidateRepositoryRef(value string) error

ValidateRepositoryRef enforces the public git-source repository grammar and literal-address policy.

Types

type Checkout

type Checkout struct {
	Path       string
	Repository string
	// Commit is the verified full revision of the materialized tree.
	Commit string
	// contains filtered or unexported fields
}

Checkout owns a temporary repository tree until Close releases it.

func (*Checkout) Close

func (c *Checkout) Close() error

Close releases the owned tree once and retains the first cleanup result.

type Client

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

Client downloads extension trees from public git repositories.

func NewClient

func NewClient(opts ...Option) *Client

NewClient constructs a git registry source.

func (*Client) Capabilities

func (c *Client) Capabilities() registry.SourceCaps

Capabilities reports that arbitrary git repositories are not searchable.

func (*Client) Checkout

func (c *Client) Checkout(ctx context.Context, slug, ref string) (_ *Checkout, err error)

Checkout transfers an exact repository tree to the caller, who must close it after capturing the package.

func (*Client) Close

func (c *Client) Close() error

Close has no retained resources.

func (*Client) Download

func (c *Client) Download(
	ctx context.Context,
	slug string,
	opts registry.DownloadOpts,
) (_ *registry.DownloadResult, err error)

Download shallow-clones a repository and returns its working tree as a gzip archive.

func (*Client) Info

func (c *Client) Info(_ context.Context, slug string) (*registry.Detail, error)

Info projects repository metadata without making a network request.

func (*Client) Name

func (c *Client) Name() string

Name returns the registry source identifier.

func (*Client) Search

Search is not supported for arbitrary git repositories.

type Option

type Option func(*Client)

Option configures a git registry client.

func WithCheckoutTempDir

func WithCheckoutTempDir(directory string) Option

WithCheckoutTempDir places owned checkouts under an operator-selected, quota-controlled directory.

func WithLookPath

func WithLookPath(lookPath func(string) (string, error)) Option

WithLookPath overrides executable discovery.

func WithRunner

func WithRunner(run commandRunner) Option

WithRunner overrides command execution.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout overrides the clone timeout.

Jump to

Keyboard shortcuts

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