Gitignore.Matcher (Gitignore v0.1.0)

Copy Markdown View Source

Compiled matcher for one set of gitignore rules.

Matchers are usually produced by Gitignore.compile/2.

Summary

Functions

Returns the matching rule for path, mirroring git check-ignore -v.

Types

t()

@type t() :: %Gitignore.Matcher{
  base: binary(),
  casefold?: boolean(),
  rules: [Gitignore.Rule.t()]
}

Functions

check(matcher, path, opts)

@spec check(t(), binary(), keyword()) ::
  {:ignored | :unignored, Gitignore.Rule.t()} | :not_ignored

Returns the matching rule for path, mirroring git check-ignore -v.

Requires type: :file | :directory. Pass parents: false to skip the ancestor-directory walk; Gitignore.Stack does its own walk across all layered matchers.

new(rules, opts \\ [])

@spec new(
  [Gitignore.Rule.t()],
  keyword()
) :: t()