add method to check if a path is ignored

This commit is contained in:
Cam Cope
2016-01-25 02:54:00 -08:00
parent fa60e2233d
commit 95ad6b1b0a

View File

@@ -349,6 +349,26 @@ Repository_lookup_branch(Repository *self, PyObject *args)
} }
PyDoc_STRVAR(Repository_path_is_ignored__doc__,
"Check if a path is ignored in the repository.");
PyObject *
Repository_path_is_ignored(Repository *self, PyObject *args)
{
int ignored;
char *path;
if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
git_ignore_path_is_ignored(&ignored, self->repo, path);
if (ignored == 1)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
PyDoc_STRVAR(Repository_revparse_single__doc__, PyDoc_STRVAR(Repository_revparse_single__doc__,
"revparse_single(revision) -> Object\n" "revparse_single(revision) -> Object\n"
"\n" "\n"
@@ -1633,6 +1653,7 @@ PyMethodDef Repository_methods[] = {
METHOD(Repository, lookup_note, METH_VARARGS), METHOD(Repository, lookup_note, METH_VARARGS),
METHOD(Repository, git_object_lookup_prefix, METH_O), METHOD(Repository, git_object_lookup_prefix, METH_O),
METHOD(Repository, lookup_branch, METH_VARARGS), METHOD(Repository, lookup_branch, METH_VARARGS),
METHOD(Repository, path_is_ignored, METH_VARARGS),
METHOD(Repository, listall_branches, METH_VARARGS), METHOD(Repository, listall_branches, METH_VARARGS),
METHOD(Repository, create_branch, METH_VARARGS), METHOD(Repository, create_branch, METH_VARARGS),
METHOD(Repository, reset, METH_VARARGS), METHOD(Repository, reset, METH_VARARGS),