internal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IgnoreSet

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

IgnoreSet wraps a gogitignore.Tree. The walker calls ensureNode for each directory it visits; the Tree internally keeps per-dir matchers so match() only iterates patterns from the path's ancestor chain.

func NewIgnoreSet

func NewIgnoreSet(root string) *IgnoreSet

func (*IgnoreSet) EnsureNode

func (s *IgnoreSet) EnsureNode(relDir string)

EnsureNode loads relDir's .gitignore/.ignore (if any) into the tree. Called once per directory by the walker.

func (*IgnoreSet) LoadDir

func (s *IgnoreSet) LoadDir(absDir, relDir string)

func (*IgnoreSet) Match

func (s *IgnoreSet) Match(rel string, isDir bool) bool

Match reports whether rel (relative to root) is ignored.

type MatchOpts

type MatchOpts struct {
	FixedString     bool // -F: treat pattern as literal text
	CaseInsensitive bool // -i
	WordBoundary    bool // -w: match only at word boundaries
}

type Matcher

type Matcher struct {
	Re      *regexp.Regexp
	Literal []byte
}

Matcher decides whether a line matches the user's pattern. It supports three regimes: pure fixed-string (re == nil), regex with a literal pre-filter, and regex without one.

func CompileMatcher

func CompileMatcher(pattern string, opts MatchOpts) (*Matcher, error)

func (*Matcher) Match

func (m *Matcher) Match(line []byte) bool

Jump to

Keyboard shortcuts

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