diff options
author | Russell Belfer <arrbee@arrbee.com> | 2011-12-16 10:56:43 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2011-12-20 16:32:58 -0800 |
commit | ee1f0b1aed7798908d9e038b006b66f868613fc3 (patch) | |
tree | c60350029b9e4bb14811ac13caf59ad86424f33e /include/git2/attr.h | |
parent | be00b00dd1468f1c625ca3fadc61f2a16edfb8d5 (diff) | |
download | libgit2-ee1f0b1aed7798908d9e038b006b66f868613fc3.tar.gz |
Add APIs for git attributes
This adds APIs for querying git attributes. In addition to
the new API in include/git2/attr.h, most of the action is in
src/attr_file.[hc] which contains utilities for dealing with
a single attributes file, and src/attr.[hc] which contains
the implementation of the APIs that merge all applicable
attributes files.
Diffstat (limited to 'include/git2/attr.h')
-rw-r--r-- | include/git2/attr.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/git2/attr.h b/include/git2/attr.h new file mode 100644 index 000000000..d585937b7 --- /dev/null +++ b/include/git2/attr.h @@ -0,0 +1,56 @@ +/* + * 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); + +/** @} */ +GIT_END_DECL +#endif + |