]> git.proxmox.com Git - libgit2.git/blob - src/index.h
Merge pull request #2178 from libgit2/rb/fix-short-id
[libgit2.git] / src / index.h
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
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_index_h__
8 #define INCLUDE_index_h__
9
10 #include "fileops.h"
11 #include "filebuf.h"
12 #include "vector.h"
13 #include "tree-cache.h"
14 #include "git2/odb.h"
15 #include "git2/index.h"
16
17 #define GIT_INDEX_FILE "index"
18 #define GIT_INDEX_FILE_MODE 0666
19
20 struct git_index {
21 git_refcount rc;
22
23 char *index_file_path;
24
25 git_futils_filestamp stamp;
26 git_vector entries;
27
28 unsigned int on_disk:1;
29
30 unsigned int ignore_case:1;
31 unsigned int distrust_filemode:1;
32 unsigned int no_symlinks:1;
33
34 git_tree_cache *tree;
35
36 git_vector names;
37 git_vector reuc;
38
39 git_vector_cmp entries_cmp_path;
40 git_vector_cmp entries_search;
41 git_vector_cmp entries_search_path;
42 git_vector_cmp reuc_search;
43 };
44
45 struct git_index_conflict_iterator {
46 git_index *index;
47 size_t cur;
48 };
49
50 extern void git_index_entry__init_from_stat(
51 git_index_entry *entry, struct stat *st, bool trust_mode);
52
53 extern size_t git_index__prefix_position(git_index *index, const char *path);
54
55 extern int git_index_entry__cmp(const void *a, const void *b);
56 extern int git_index_entry__cmp_icase(const void *a, const void *b);
57
58 extern int git_index__find(
59 size_t *at_pos, git_index *index, const char *path, size_t path_len, int stage);
60
61 extern void git_index__set_ignore_case(git_index *index, bool ignore_case);
62
63 extern unsigned int git_index__create_mode(unsigned int mode);
64
65 #endif