repository.h 1.19 KB
Newer Older
Vicent Marti committed
1 2 3 4 5 6
/*
 * Copyright (C) 2009-2011 the libgit2 contributors
 *
 * 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
#ifndef INCLUDE_repository_h__
#define INCLUDE_repository_h__

10 11 12 13
#include "git2/common.h"
#include "git2/oid.h"
#include "git2/odb.h"
#include "git2/repository.h"
14
#include "git2/object.h"
15 16

#include "hashtable.h"
17
#include "index.h"
Vicent Marti committed
18
#include "cache.h"
19
#include "refs.h"
20
#include "buffer.h"
21
#include "odb.h"
22

23 24
#define DOT_GIT ".git"
#define GIT_DIR DOT_GIT "/"
25 26
#define GIT_DIR_MODE 0755
#define GIT_BARE_DIR_MODE 0777
27

28
struct git_object {
Vicent Marti committed
29
	git_cached_obj cached;
30
	git_repository *repo;
Vicent Marti committed
31
	git_otype type;
32 33 34 35
};

struct git_repository {
	git_odb *db;
36

Vicent Marti committed
37
	git_cache objects;
38
	git_refcache references;
39 40 41 42 43 44

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

45 46
	unsigned is_bare:1;
	unsigned int lru_counter;
47 48
};

49 50
/* fully free the object; internal method, do not
 * export */
Vicent Marti committed
51
void git_object__free(void *object);
52

Vicent Marti committed
53
int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end, const char *header);
54
void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid);
55

56
#endif