summaryrefslogtreecommitdiff
path: root/include/git2/attr.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2011-12-28 23:28:50 -0800
committerRussell Belfer <arrbee@arrbee.com>2011-12-29 00:01:10 -0800
commit73b51450a3194ddaa2ac180a1fea25fdf66971bb (patch)
tree4a6f4f0cfc90ded7f7734da2b6a9353d9bb0890b /include/git2/attr.h
parentee1f0b1aed7798908d9e038b006b66f868613fc3 (diff)
downloadlibgit2-73b51450a3194ddaa2ac180a1fea25fdf66971bb.tar.gz
Add support for macros and cache flush API.
Add support for git attribute macro definitions. Also, add support for cache flush API to clear the attribute file content cache when needed. Additionally, improved the handling of global and system files, making common utility functions in fileops and converting config and attr to both use the common functions. Adds a bunch more tests and fixed some memory leaks. Note that adding macros required me to use refcounted attribute assignment definitions, which complicated, but probably improved memory usage.
Diffstat (limited to 'include/git2/attr.h')
-rw-r--r--include/git2/attr.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/git2/attr.h b/include/git2/attr.h
index d585937b..f4c5975a 100644
--- a/include/git2/attr.h
+++ b/include/git2/attr.h
@@ -50,6 +50,30 @@ GIT_EXTERN(int) git_attr_foreach(
int (*callback)(const char *name, const char *value, void *payload),
void *payload);
+/**
+ * Flush the gitattributes cache.
+ *
+ * Call this if you have reason to believe that the attributes files
+ * on disk no longer match the cached contents of memory.
+ */
+GIT_EXTERN(void) git_attr_cache_flush(
+ git_repository *repo);
+
+/**
+ * Add a macro definition.
+ *
+ * Macros will automatically be loaded from the top level .gitattributes
+ * file of the repository (plus the build-in "binary" macro). This
+ * function allows you to add others. For example, to add the default
+ * macro, you would call:
+ *
+ * git_attr_add_macro(repo, "binary", "-diff -crlf");
+ */
+GIT_EXTERN(int) git_attr_add_macro(
+ git_repository *repo,
+ const char *name,
+ const char *values);
+
/** @} */
GIT_END_DECL
#endif