libgit2

git_status_should_ignore

Version:

Test if the ignore rules apply to a given file.

This function checks the ignore rules to see if they would apply to the given file. This indicates if the file would be ignored regardless of whether the file is already in the index or committed to the repository.

One way to think of this is if you were to do "git add ." on the directory containing the file, would it be added or not?

Signature

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

Parameters

int *
In
ignored

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

In
repo

A repository object

const char *
In
path

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

Returns

int

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

Versions