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 ¶
func (f *Fetcher) Fetch(ctx context.Context, repo *manifest.GitRepository) (*store.SourceArtifact, error)
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.