summaryrefslogtreecommitdiff
path: root/src/attr_file.h
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2012-05-05 14:22:06 -0700
committerVicent Martí <tanoku@gmail.com>2012-05-05 14:22:06 -0700
commit4ef14af93517b3842bc0dfa24147cf10dd029582 (patch)
tree88f90fa8c9d903f072a2b1c647c51a9899e520c7 /src/attr_file.h
parentf95e8cc07c85034f737872455fce2895186be19d (diff)
parent282283acc65bab9de231a2b3dc489eb171d5f1cf (diff)
downloadlibgit2-development-merge.tar.gz
Merge pull request #664 from arrbee/attrs-from-indexdevelopment-merge
Support git attrs from index (and bare repo)
Diffstat (limited to 'src/attr_file.h')
-rw-r--r--src/attr_file.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/attr_file.h b/src/attr_file.h
index 10851bc49..ec488c4dc 100644
--- a/src/attr_file.h
+++ b/src/attr_file.h
@@ -48,7 +48,7 @@ typedef struct {
} git_attr_assignment;
typedef struct {
- char *path; /* cache the path this was loaded from */
+ char *key; /* cache "source#path" this was loaded from */
git_vector rules; /* vector of <rule*> or <fnmatch*> */
git_pool *pool;
bool pool_is_allocated;
@@ -61,20 +61,25 @@ typedef struct {
int is_dir;
} git_attr_path;
+typedef enum {
+ GIT_ATTR_FILE_FROM_FILE = 0,
+ GIT_ATTR_FILE_FROM_INDEX = 1
+} git_attr_file_source;
+
/*
* git_attr_file API
*/
-extern int git_attr_file__new(git_attr_file **attrs_ptr, git_pool *pool);
+extern int git_attr_file__new(
+ git_attr_file **attrs_ptr, git_attr_file_source src, const char *path, git_pool *pool);
+
+extern int git_attr_file__new_and_load(
+ git_attr_file **attrs_ptr, const char *path);
+
extern void git_attr_file__free(git_attr_file *file);
-extern int git_attr_file__from_buffer(
+extern int git_attr_file__parse_buffer(
git_repository *repo, const char *buf, git_attr_file *file);
-extern int git_attr_file__from_file(
- git_repository *repo, const char *path, git_attr_file *file);
-
-extern int git_attr_file__set_path(
- git_repository *repo, const char *path, git_attr_file *file);
extern int git_attr_file__lookup_one(
git_attr_file *file,