diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-01-02 09:56:48 +0100 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-01-02 09:56:48 +0100 |
| commit | 9191a6d2466d0f3c187a66f65757c95c1c3f772d (patch) | |
| tree | 1fca9c4f9498eb01b3ff91b2ca4425d83c62b393 /include/git2 | |
| parent | 9dd4c3e80690ec08eba604e5218d0f4abb8f1a02 (diff) | |
| parent | bd370b14fefdba3844a9bf0bbf87171ca48f49be (diff) | |
| download | libgit2-9191a6d2466d0f3c187a66f65757c95c1c3f772d.tar.gz | |
Merge remote-tracking branch 'arrbee/git-attributes' into development
Conflicts:
tests-clay/clay_main.c
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/attr.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/include/git2/attr.h b/include/git2/attr.h new file mode 100644 index 000000000..f4c5975a6 --- /dev/null +++ b/include/git2/attr.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009-2011 the libgit2 contributors + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_attr_h__ +#define INCLUDE_git_attr_h__ + +#include "common.h" +#include "types.h" + +/** + * @file git2/attr.h + * @brief Git attribute management routines + * @defgroup git_attr Git attribute management routines + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +#define GIT_ATTR_TRUE git_attr__true +#define GIT_ATTR_FALSE git_attr__false +#define GIT_ATTR_UNSPECIFIED NULL + +GIT_EXTERN(const char *)git_attr__true; +GIT_EXTERN(const char *)git_attr__false; + + +/** + * Lookup attribute for path returning string caller must free + */ +GIT_EXTERN(int) git_attr_get( + git_repository *repo, const char *path, const char *name, + const char **value); + +/** + * Lookup list of attributes for path, populating array of strings + */ +GIT_EXTERN(int) git_attr_get_many( + git_repository *repo, const char *path, + size_t num_attr, const char **names, + const char **values); + +/** + * Perform an operation on each attribute of a path. + */ +GIT_EXTERN(int) git_attr_foreach( + git_repository *repo, const char *path, + 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 + |
