diff options
Diffstat (limited to 'src/repository.h')
| -rw-r--r-- | src/repository.h | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/repository.h b/src/repository.h index 5318ed45c..fef1c7da0 100644 --- a/src/repository.h +++ b/src/repository.h @@ -9,6 +9,7 @@ #include "hashtable.h" #include "index.h" +#include "cache.h" #include "refs.h" #define DOT_GIT ".git" @@ -16,28 +17,17 @@ #define GIT_OBJECTS_DIR "objects/" #define GIT_INDEX_FILE "index" -typedef struct { - git_rawobj raw; - void *write_ptr; - size_t written_bytes; - int open:1; -} git_odb_source; - struct git_object { - git_oid id; + git_cached_obj cached; git_repository *repo; - git_odb_source source; - unsigned short refcount; - unsigned char in_memory, modified; + git_otype type; }; struct git_repository { git_odb *db; git_index *index; - git_hashtable *objects; - git_vector memory_objects; - + git_cache objects; git_refcache references; char *path_repository; @@ -45,35 +35,15 @@ struct git_repository { char *path_odb; char *path_workdir; - unsigned is_bare:1, gc_enabled:1; + unsigned is_bare:1; + unsigned int lru_counter; }; -int git_object__source_open(git_object *object); -void git_object__source_close(git_object *object); - /* fully free the object; internal method, do not * export */ -void git_object__free(git_object *object); - -int git__source_printf(git_odb_source *source, const char *format, ...); -int git__source_write(git_odb_source *source, const void *bytes, size_t len); +void git_object__free(void *object); int git__parse_oid(git_oid *oid, char **buffer_out, const char *buffer_end, const char *header); -int git__write_oid(git_odb_source *src, const char *header, const git_oid *oid); - -#define GIT_OBJECT_INCREF(repo, ob) git_object__incref((repo), (git_object *)(ob)) -#define GIT_OBJECT_DECREF(repo, ob) git_object__decref((repo), (git_object *)(ob)) - -GIT_INLINE(void) git_object__incref(git_repository *repo, struct git_object *object) -{ - if (repo && repo->gc_enabled && object) - object->refcount++; -} - -GIT_INLINE(void) git_object__decref(git_repository *repo, struct git_object *object) -{ - if (repo && repo->gc_enabled && object) - git_object_close(object); -} +int git__write_oid(git_odb_stream *src, const char *header, const git_oid *oid); #endif |
