Gitignore.Wildmatch (Gitignore v0.1.0)

Copy Markdown View Source

Wildmatch pattern matching used by gitignore rules.

This module only matches one pattern against one path. It does not know about negation, directory-only rules, ignore-file ordering, or nested ignore files.

Matching is byte-oriented, like git's wildmatch: ? matches exactly one byte, and casefold: true folds ASCII letters only. Behavior is verified against the t3070 fixture suite extracted from git, including git's quirks: a malformed character class or a lone trailing backslash fails the whole match, and ** is only special when it sits between slashes or pattern boundaries.

Summary

Functions

Returns true when pattern matches path.

Types

option()

@type option() :: {:pathname, boolean()} | {:casefold, boolean()}

Functions

match?(pattern, path, opts \\ [])

@spec match?(binary(), binary(), [option()]) :: boolean()

Returns true when pattern matches path.

In pathname mode, ?, *, and character classes do not match /.