gittree

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package gittree admits direct inputs and lazy Git tree views.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdmitDirectory added in v0.7.3

func AdmitDirectory(ctx context.Context, location *gitrepo.Location) (*store.SourceArtifact, error)

AdmitDirectory constructs the direct input artifact at the resolved local root. Synthetic source labels MUST use their already admitted filesystem instead.

func ContentFingerprint added in v0.7.3

func ContentFingerprint(ctx context.Context, input fs.FS) (string, error)

ContentFingerprint identifies selected bytes once per stable admitted view. Immutable views retain their acquisition identity; mutable identities remain separate.

func ExcludeDirectory added in v0.7.3

func ExcludeDirectory(input *store.SourceArtifact, directory string) *store.SourceArtifact

ExcludeDirectory retains immutable source membership without the resolved active cache directory. Callers MUST supply the cache owner's directory before source observations begin.

func Label added in v0.7.3

func Label(opts LabelOptions) (string, string)

Label returns an ownership coordinate and its key without accessing the filesystem.

func NormalizeSparsePaths added in v0.7.3

func NormalizeSparsePaths(paths []string) []string

NormalizeSparsePaths removes one leading ./ from each sparse selection. The result may share backing with paths and MUST remain immutable.

func Sub added in v0.7.3

func Sub(input fs.FS, dir string) (fs.FS, error)

Sub admits a subtree while retaining source-owned content provenance.

Types

type FS added in v0.7.3

type FS struct {

	// Warnings is immutable admission evidence, nil when no advisory was observed.
	Warnings []manifest.Warning
	// contains filtered or unexported fields
}

FS is an admitted filesystem. Its representation is selected once by New.

func New added in v0.7.3

func New(ctx context.Context, backing billy.Filesystem, commit plumbing.Hash, opts ViewOptions) (*FS, string, error)

New validates Git metadata and creates views without reading regular blob bodies. Mutable views refresh before reuse or construction; committed identities stay pinned. An error may return warning evidence without a usable filesystem.

func (*FS) FileDigests added in v0.7.3

func (g *FS) FileDigests() map[string]string

FileDigests borrows completed selected-file evidence without reading content. Returned maps MUST remain read-only.

func (*FS) FreshInputs added in v0.7.3

func (g *FS) FreshInputs(ctx context.Context, requested []string) (InputObservations, error)

FreshInputs MUST observe mutable bytes and membership without prior operation memos or Git stat evidence. A nil request observes every file. An explicit request reads only those bodies while retaining complete node membership.

func (*FS) Location added in v0.7.3

func (g *FS) Location() *gitrepo.Location

Location returns the resolved disk identity retained by admission.

func (*FS) Lstat added in v0.7.3

func (g *FS) Lstat(name string) (fs.FileInfo, error)

Lstat keeps excluded paths absent without following aliases.

func (*FS) Open added in v0.7.3

func (g *FS) Open(name string) (fs.File, error)

Open keeps excluded paths absent from file and directory handles.

func (*FS) OpenRegular added in v0.7.3

func (g *FS) OpenRegular(name string) (fs.File, error)

OpenRegular applies membership before the regular-file shortcut.

func (*FS) OperationView added in v0.7.3

func (g *FS) OperationView() *FS

OperationView creates private local observations while retaining admitted membership.

func (*FS) PolicyEvidence added in v0.7.3

func (g *FS) PolicyEvidence() any

PolicyEvidence returns the ordered ignore-file content used to shape the view. Policy evidence MUST NOT be used as immutable source acquisition authority.

func (*FS) ReadDir added in v0.7.3

func (g *FS) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir omits the excluded directory without mutating shared listings.

func (*FS) ReadFile added in v0.7.3

func (g *FS) ReadFile(name string) ([]byte, error)

ReadFile keeps optimized file reads within admitted membership.

func (g *FS) ReadLink(name string) (string, error)

ReadLink keeps excluded paths absent from link reads.

func (*FS) SourcePolicy added in v0.7.3

func (g *FS) SourcePolicy(ctx context.Context) (*sourceignore.Matcher, error)

SourcePolicy returns the admission's captured Flux policy without reshaping its files.

func (*FS) Stat added in v0.7.3

func (g *FS) Stat(name string) (fs.FileInfo, error)

Stat keeps excluded paths absent from metadata reads.

type InputObservations added in v0.7.3

type InputObservations struct {
	Files map[string]string
	Types map[string]fs.FileMode
}

InputObservations borrows current file identities and node kinds from one source observation. Both maps MUST remain read-only.

type LabelOptions added in v0.7.3

type LabelOptions struct {
	Root, Key string
	Mode      ViewMode
	Source    manifest.NamedResource
	Content   any
}

LabelOptions supplies ownership coordinates independently of acquisition identity.

type ViewMode added in v0.7.3

type ViewMode uint8

ViewMode selects admitted input and source artifact membership.

const (
	// Source omits links and applies the Flux source-ignore policy.
	Source ViewMode = iota
	// RemoteBase follows confined file aliases and omits hidden directories.
	RemoteBase
	// Direct admits local files without source-ignore shaping and omits links.
	Direct
)

type ViewOptions added in v0.7.3

type ViewOptions struct {

	// Content carries source coordinates without filesystem or routing state.
	Content  any
	Location *gitrepo.Location
	Mode     ViewMode
	Sparse   []string
	Ignore   string
	Worktree billy.Filesystem
	// Current supplies admitted bytes; Git views also expose read-only local objects.
	Current fs.FS
	// CurrentContent carries the acquisition owner's identity when Current wraps its admitted view.
	CurrentContent string
	// Changes routes complete, unfiltered differences to commit bodies.
	Changes []string
	// contains filtered or unexported fields
}

ViewOptions shapes a commit view without changing its object backing.

Jump to

Keyboard shortcuts

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