libgit2

git_status_should_ignore

Version:

Test if the ignore rules apply to a given file.

This function simply checks the ignore rules to see if they would apply to the given file. Unlike git_status_file(), this indicates if the file would be ignored regardless of whether the file is already in the index or in the repository.

Signature

int git_status_should_ignore(git_repository *repo, const char *path, int *ignored);

Parameters

In
repo

a repository object

const char *
In
path

the file to check ignores for, rooted at the repo's workdir

int *
In
ignored

boolean returning 0 if the file is not ignored, 1 if it is

Returns

int

GIT_SUCCESS if the ignore rules could be processed for the file (regardless of whether it exists or not), or an error < 0 if they could not.

Versions