Struct ignore::gitignore::Gitignore [] [src]

pub struct Gitignore { /* fields omitted */ }

Gitignore is a matcher for the globs in one or more gitignore files in the same directory.

Methods

impl Gitignore
[src]

Creates a new gitignore matcher from the gitignore file path given.

If it's desirable to include multiple gitignore files in a single matcher, or read gitignore globs from a different source, then use GitignoreBuilder.

This always returns a valid matcher, even if it's empty. In particular, a Gitignore file can be partially valid, e.g., when one glob is invalid but the rest aren't.

Note that I/O errors are ignored. For more granular control over errors, use GitignoreBuilder.

Creates a new gitignore matcher from the global ignore file, if one exists.

The global config file path is specified by git's core.excludesFile config option.

Git's config file location is $HOME/.gitconfig. If $HOME/.gitconfig does not exist or does not specify core.excludesFile, then $XDG_CONFIG_HOME/git/ignore is read. If $XDG_CONFIG_HOME is not set or is empty, then $HOME/.config/git/ignore is used instead.

Creates a new empty gitignore matcher that never matches anything.

Its path is empty.

Returns the directory containing this gitignore matcher.

All matches are done relative to this path.

Returns true if and only if this gitignore has zero globs, and therefore never matches any file path.

Returns the total number of globs, which should be equivalent to num_ignores + num_whitelists.

Returns the total number of ignore globs.

Returns the total number of whitelisted globs.

Returns whether the given file path matched a pattern in this gitignore matcher.

is_dir should be true if the path refers to a directory and false otherwise.

The given path is matched relative to the path given when building the matcher. Specifically, before matching path, its prefix (as determined by a common suffix of the directory containing this gitignore) is stripped. If there is no common suffix/prefix overlap, then path is assumed to be relative to this matcher.

Trait Implementations

impl Clone for Gitignore
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Gitignore
[src]

Formats the value using the given formatter.