ignore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ignore implements the DevSpecs v0.1 ignore stack: repo-root .gitignore, .git/info/exclude when present, and repo-root .aiignore (gitignore-like syntax).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, m *Matcher) context.Context

WithContext returns ctx carrying m for adapters and discover (nil m is a no-op).

Types

type Matcher

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

Matcher answers whether a repo-relative path should be skipped (gitignore rules).

func FromContext

func FromContext(ctx context.Context) *Matcher

FromContext returns the matcher from ctx, or nil.

func NewMatcher

func NewMatcher(repoRoot string) (*Matcher, error)

NewMatcher loads .gitignore, .git/info/exclude, and .aiignore from repoRoot (missing files ignored). Returns a non-nil Matcher; matching is a no-op when no patterns exist.

func (*Matcher) RelFromAbs

func (m *Matcher) RelFromAbs(absPath string) (string, bool)

RelFromAbs returns the slash-separated path relative to the matcher's repo root, or "" if outside.

func (*Matcher) ShouldSkip

func (m *Matcher) ShouldSkip(relPath string, isDir bool) bool

ShouldSkip reports whether relPath (relative to repo root, slash-separated) should be ignored. isDir should match the entry being tested so directory-only patterns behave like git.

Jump to

Keyboard shortcuts

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