2 * Copyright (C) 2009-2012 the libgit2 contributors
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.
7 #ifndef INCLUDE_attr_h__
8 #define INCLUDE_attr_h__
10 #include "attr_file.h"
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"
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 */
27 typedef int (*git_attr_file_parser
)(
28 git_repository
*, void *, const char *, git_attr_file
*);
30 extern int git_attr_cache__init(git_repository
*repo
);
32 extern int git_attr_cache__insert_macro(
33 git_repository
*repo
, git_attr_rule
*macro
);
35 extern git_attr_rule
*git_attr_cache__lookup_macro(
36 git_repository
*repo
, const char *name
);
38 extern int git_attr_cache__push_file(
42 git_attr_file_source source
,
43 git_attr_file_parser parse
,
44 void *parsedata
, /* passed through to parse function */
47 extern int git_attr_cache__internal_file(
50 git_attr_file
**file_ptr
);
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
);
56 extern int git_attr_cache__decide_sources(
57 uint32_t flags
, bool has_wd
, bool has_index
, git_attr_file_source
*srcs
);