repository.h 1003 Bytes
Newer Older
1 2 3
#ifndef INCLUDE_repository_h__
#define INCLUDE_repository_h__

4 5 6 7
#include "git2/common.h"
#include "git2/oid.h"
#include "git2/odb.h"
#include "git2/repository.h"
8
#include "git2/object.h"
9 10

#include "hashtable.h"
11
#include "index.h"
Vicent Marti committed
12
#include "cache.h"
13
#include "refs.h"
14
#include "buffer.h"
15

16 17 18 19 20
#define DOT_GIT ".git"
#define GIT_DIR DOT_GIT "/"
#define GIT_OBJECTS_DIR "objects/"
#define GIT_INDEX_FILE "index"

21
struct git_object {
Vicent Marti committed
22
	git_cached_obj cached;
23
	git_repository *repo;
Vicent Marti committed
24
	git_otype type;
25 26 27 28
};

struct git_repository {
	git_odb *db;
29

Vicent Marti committed
30
	git_cache objects;
31
	git_refcache references;
32 33 34 35 36 37

	char *path_repository;
	char *path_index;
	char *path_odb;
	char *path_workdir;

38 39
	unsigned is_bare:1;
	unsigned int lru_counter;
40 41
};

42 43
/* fully free the object; internal method, do not
 * export */
Vicent Marti committed
44
void git_object__free(void *object);
45

Vicent Marti committed
46
int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end, const char *header);
47
void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid);
48

49
#endif