gitignore

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gitignore provides gitignore pattern matching functionality. It supports parsing .gitignore files and matching paths against patterns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

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

Matcher matches paths against gitignore patterns.

func NewMatcher

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

NewMatcher creates a Matcher by loading all .gitignore files from root up to each subdirectory. The root parameter should be the project root directory.

func (*Matcher) LoadNestedGitignore

func (m *Matcher) LoadNestedGitignore(relDir string) error

LoadNestedGitignore loads a .gitignore file from a subdirectory. The relDir is the relative path from root to the directory containing .gitignore.

func (*Matcher) Match

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

Match checks if a path should be ignored. The path should be relative to the matcher's root. isDir indicates whether the path is a directory.

func (*Matcher) ShouldTraverse

func (m *Matcher) ShouldTraverse(relPath string) bool

ShouldTraverse checks if a directory should be traversed. This is an optimization to skip entire directory trees.

Jump to

Keyboard shortcuts

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