index.h 1.25 KB
Newer Older
Vicent Marti committed
1
/*
schu committed
2
 * Copyright (C) 2009-2012 the libgit2 contributors
Vicent Marti committed
3 4 5 6
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
7 8 9 10
#ifndef INCLUDE_index_h__
#define INCLUDE_index_h__

#include "fileops.h"
11
#include "filebuf.h"
12
#include "vector.h"
13
#include "tree-cache.h"
14 15
#include "git2/odb.h"
#include "git2/index.h"
16

17 18 19
#define GIT_INDEX_FILE "index"
#define GIT_INDEX_FILE_MODE 0666

20
struct git_index {
21 22
	git_refcount rc;

23
	char *index_file_path;
24

25
	git_futils_filestamp stamp;
26
	git_vector entries;
27

28
	unsigned int on_disk:1;
29 30 31 32 33

	unsigned int ignore_case:1;
	unsigned int distrust_filemode:1;
	unsigned int no_symlinks:1;

34
	git_tree_cache *tree;
35

Edward Thomson committed
36
	git_vector reuc;
37

Edward Thomson committed
38
	git_vector_cmp entries_cmp_path;
39
	git_vector_cmp entries_search;
Edward Thomson committed
40 41
	git_vector_cmp entries_search_path;
	git_vector_cmp reuc_search;
42 43
};

44
extern void git_index_entry__init_from_stat(git_index_entry *entry, struct stat *st);
45

46 47
extern unsigned int git_index__prefix_position(git_index *index, const char *path);

48 49 50
extern int git_index_entry__cmp(const void *a, const void *b);
extern int git_index_entry__cmp_icase(const void *a, const void *b);

51 52 53
extern int git_index_read_tree_match(
	git_index *index, git_tree *tree, git_strarray *strspec);

54
#endif