]> git.proxmox.com Git - libgit2.git/blob - src/attr.h
Merge pull request #968 from arrbee/diff-support-typechange
[libgit2.git] / src / attr.h
1 /*
2 * Copyright (C) 2009-2012 the libgit2 contributors
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_attr_h__
8 #define INCLUDE_attr_h__
9
10 #include "attr_file.h"
11 #include "strmap.h"
12
13 #define GIT_ATTR_CONFIG "core.attributesfile"
14 #define GIT_ATTR_CONFIG_DEFAULT ".config/git/attributes"
15 #define GIT_IGNORE_CONFIG "core.excludesfile"
16 #define GIT_IGNORE_CONFIG_DEFAULT ".config/git/ignore"
17
18 typedef struct {
19 int initialized;
20 git_pool pool;
21 git_strmap *files; /* hash path to git_attr_file of rules */
22 git_strmap *macros; /* hash name to vector<git_attr_assignment> */
23 const char *cfg_attr_file; /* cached value of core.attributesfile */
24 const char *cfg_excl_file; /* cached value of core.excludesfile */
25 } git_attr_cache;
26
27 typedef int (*git_attr_file_parser)(
28 git_repository *, void *, const char *, git_attr_file *);
29
30 extern int git_attr_cache__init(git_repository *repo);
31
32 extern int git_attr_cache__insert_macro(
33 git_repository *repo, git_attr_rule *macro);
34
35 extern git_attr_rule *git_attr_cache__lookup_macro(
36 git_repository *repo, const char *name);
37
38 extern int git_attr_cache__push_file(
39 git_repository *repo,
40 const char *base,
41 const char *filename,
42 git_attr_file_source source,
43 git_attr_file_parser parse,
44 void *parsedata, /* passed through to parse function */
45 git_vector *stack);
46
47 extern int git_attr_cache__internal_file(
48 git_repository *repo,
49 const char *key,
50 git_attr_file **file_ptr);
51
52 /* returns true if path is in cache */
53 extern bool git_attr_cache__is_cached(
54 git_repository *repo, git_attr_file_source source, const char *path);
55
56 extern int git_attr_cache__decide_sources(
57 uint32_t flags, bool has_wd, bool has_index, git_attr_file_source *srcs);
58
59 #endif