sourceignore

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Overview

Package sourceignore builds the file-exclusion matcher Flux's source-controller applies when it packages a GitRepository/OCIRepository artifact: its default patterns (.git/, .github/, *.jpg/png/zip, .sops.yaml, .flux.yaml, .goreleaser.yml, …) plus any in-tree .sourceignore files plus caller-supplied spec.ignore patterns.

It is a leaf package — it depends only on the vendored fluxcd/go-git ignore primitives, never on pkg/source or pkg/kustomize — so BOTH the source-fetch artifact filtering (pkg/source.ApplyIgnore) and the in-memory kustomize tree materialization (pkg/kustomize) can consume one matcher without an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint added in v0.6.2

func Fingerprint(root string) (string, error)

Fingerprint digests every .sourceignore file under root — relative path and content, in LoadIgnorePatterns' traversal order — so work cached against a Matcher built from root can be keyed on the files that shaped it: an edit, addition, or removal of any .sourceignore changes the result. Directories named .git are skipped, as the loader skips them.

Types

type Matcher

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

Matcher reports whether a path within a source tree rooted at a fixed directory is excluded from the artifact. It is safe for concurrent reads.

func New

func New(root string, extra *string, withDefaults bool) (*Matcher, error)

New builds a Matcher for the tree rooted at root.

withDefaults adds Flux's default VCS + ExcludeExt/CI/Extra patterns — the GitRepository/OCIRepository behavior; pass false for the Bucket flavor (in-tree .sourceignore + extra only). extra, when non-empty, appends caller patterns (a source's spec.ignore).

func (*Matcher) Match

func (m *Matcher) Match(rel string, isDir bool) bool

Match reports whether rel (a path relative to the matcher's root, using the OS separator) is excluded. isDir distinguishes directory-only patterns.

Jump to

Keyboard shortcuts

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