summaryrefslogtreecommitdiff
path: root/src/ignore.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-11 16:01:48 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-11 16:01:48 -0800
commit6a67a812c224878483659c6f25ca21573d1c309b (patch)
tree700df7d116f14bae08e437379bd4dfd44aaba825 /src/ignore.c
parentfdaa924037b66ee898fab503836a3d67194efacc (diff)
downloadlibgit2-6a67a812c224878483659c6f25ca21573d1c309b.tar.gz
Allow ignores (and attribs) for nonexistent files
This fixes issue 532 that attributes (and gitignores) could not be checked for files that don't exist. It should be possible to query such things regardless of the existence of the file.
Diffstat (limited to 'src/ignore.c')
-rw-r--r--src/ignore.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ignore.c b/src/ignore.c
index 8bf22e34a..7639b7ba9 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -146,3 +146,17 @@ found:
return error;
}
+
+int git_ignore_is_ignored(git_repository *repo, const char *path, int *ignored)
+{
+ int error;
+ git_vector ignores = GIT_VECTOR_INIT;
+
+ if ((error = git_ignore__for_path(repo, path, &ignores)) == GIT_SUCCESS)
+ error = git_ignore__lookup(&ignores, path, ignored);
+
+ git_ignore__free(&ignores);
+
+ return error;
+}
+