]> git.proxmox.com Git - libgit2.git/blame - src/attr.h
Merge branch 'development' into clar2
[libgit2.git] / src / attr.h
CommitLineData
df743c7d 1/*
5e0de328 2 * Copyright (C) 2009-2012 the libgit2 contributors
df743c7d
RB
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"
c2b67043 11#include "strmap.h"
df743c7d 12
95dfb031 13#define GIT_ATTR_CONFIG "core.attributesfile"
7fbca880 14#define GIT_ATTR_CONFIG_DEFAULT ".config/git/attributes"
95dfb031 15#define GIT_IGNORE_CONFIG "core.excludesfile"
f004c4a8 16#define GIT_IGNORE_CONFIG_DEFAULT ".config/git/ignore"
95dfb031 17
df743c7d
RB
18typedef struct {
19 int initialized;
19fa2bc1 20 git_pool pool;
c2b67043
RB
21 git_strmap *files; /* hash path to git_attr_file of rules */
22 git_strmap *macros; /* hash name to vector<git_attr_assignment> */
95dfb031
RB
23 const char *cfg_attr_file; /* cached value of core.attributesfile */
24 const char *cfg_excl_file; /* cached value of core.excludesfile */
df743c7d
RB
25} git_attr_cache;
26
f917481e 27typedef int (*git_attr_file_parser)(
ec40b7f9 28 git_repository *, void *, const char *, git_attr_file *);
f917481e 29
df743c7d
RB
30extern int git_attr_cache__init(git_repository *repo);
31
32extern int git_attr_cache__insert_macro(
33 git_repository *repo, git_attr_rule *macro);
34
01fed0a8
RB
35extern git_attr_rule *git_attr_cache__lookup_macro(
36 git_repository *repo, const char *name);
37
f917481e 38extern int git_attr_cache__push_file(
b6c93aef 39 git_repository *repo,
f917481e 40 const char *base,
b6c93aef 41 const char *filename,
f917481e
RB
42 git_attr_file_source source,
43 git_attr_file_parser parse,
ec40b7f9 44 void *parsedata, /* passed through to parse function */
f917481e 45 git_vector *stack);
b6c93aef 46
f917481e 47extern int git_attr_cache__internal_file(
df743c7d 48 git_repository *repo,
f917481e
RB
49 const char *key,
50 git_attr_file **file_ptr);
df743c7d 51
0d0fa7c3 52/* returns true if path is in cache */
f917481e
RB
53extern bool git_attr_cache__is_cached(
54 git_repository *repo, git_attr_file_source source, const char *path);
55
56extern int git_attr_cache__decide_sources(
57 uint32_t flags, bool has_wd, bool has_index, git_attr_file_source *srcs);
e8c96ed2 58
df743c7d 59#endif