summaryrefslogtreecommitdiff
path: root/src/ignore.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-21 17:26:39 -0700
committerRussell Belfer <rb@github.com>2012-08-21 17:26:39 -0700
commitf004c4a8a78ec1ac109b0a0c78cdebe47a5df215 (patch)
treef2732930c45178bb091c6e76e9b24472aed18d8a /src/ignore.c
parentb2be351aaddc6ba0b3a0f2cf4e09536a3b27e598 (diff)
downloadlibgit2-f004c4a8a78ec1ac109b0a0c78cdebe47a5df215.tar.gz
Add public API for internal ignores
This creates a public API for adding to the internal ignores list, which already existing but was not accessible. This adds the new default value for core.excludesfile also.
Diffstat (limited to 'src/ignore.c')
-rw-r--r--src/ignore.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ignore.c b/src/ignore.c
index 93d979f1a..b81676b94 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -1,3 +1,4 @@
+#include "git2/ignore.h"
#include "ignore.h"
#include "path.h"
@@ -203,3 +204,34 @@ cleanup:
git_attr_path__free(&path);
return 0;
}
+
+int git_ignore_add_rule(
+ git_repository *repo,
+ const char *rules)
+{
+ int error;
+ git_attr_file *ign_internal;
+
+ error = git_attr_cache__internal_file(
+ repo, GIT_IGNORE_INTERNAL, &ign_internal);
+
+ if (!error && ign_internal != NULL)
+ error = parse_ignore_file(repo, rules, ign_internal);
+
+ return error;
+}
+
+int git_ignore_clear_internal_rules(
+ git_repository *repo)
+{
+ int error;
+ git_attr_file *ign_internal;
+
+ error = git_attr_cache__internal_file(
+ repo, GIT_IGNORE_INTERNAL, &ign_internal);
+
+ if (!error && ign_internal != NULL)
+ git_attr_file__clear_rules(ign_internal);
+
+ return error;
+}