git

package
v0.0.0-...-3696fcf Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package git implements the source.Fetcher for KindGitRepository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher struct {
	Cache   *source.Cache
	Secrets source.SecretGetter
	Mirrors *MirrorCache
}

Fetcher is the source.Fetcher implementation for KindGitRepository. It owns a shared Cache so multiple GitRepository CRs writing to the same cache root serialize on slot allocation correctly. Secrets is optional; required when a GitRepository sets spec.secretRef.

Mirrors, when set, switches the default fetch path to an incremental bare-mirror-plus-worktree strategy: one bare clone per upstream URL (kept warm across runs and across refs), and per-slot worktrees are materialized by walking the commit tree out of the mirror. The legacy full PlainClone-into-slot path still runs for repos that need submodule recursion or sparse checkout — neither feature is expressible against a bare mirror without a separate fetch that defeats the cache. Leave nil to keep the legacy path everywhere.

func (*Fetcher) Fetch

Fetch implements source.TypedFetcher[*manifest.GitRepository]. The typed signature is wrapped via source.Wrap at orchestrator registration — a payload mismatch returns ErrInput once at the adapter site rather than panicking here.

type MirrorCache

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

MirrorCache holds one bare clone per unique upstream URL. The mirror is the persistent object store that incremental Fetches update; the per-(URL, ref) cache slots materialize their worktrees from it without re-cloning across runs or across refs of the same repo.

Construct via NewMirrorCache; pass to Fetcher.Mirrors. A nil Fetcher.Mirrors disables mirroring — the legacy PlainClone-into-slot path runs unchanged (used by tests and any caller that prefers the older behavior).

func NewMirrorCache

func NewMirrorCache(layout cacheroot.Layout) *MirrorCache

NewMirrorCache constructs a MirrorCache backed by the supplied Layout. The git-mirrors subtree is created lazily on first openOrFetch.

Jump to

Keyboard shortcuts

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