mirror of
https://github.com/git/git.git
synced 2026-02-28 02:42:52 +00:00
Subsequent commits will expand the `struct odb_source` to become a generic interface for accessing an object database source. As part of these refactorings we'll add a set of function pointers that will significantly expand the structure overall. Prepare for this by splitting out the `struct odb_source` into a separate header. This keeps the high-level object database interface detached from the low-level object database sources. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
29 lines
622 B
C
29 lines
622 B
C
#include "git-compat-util.h"
|
|
#include "object-file.h"
|
|
#include "odb/source.h"
|
|
#include "packfile.h"
|
|
|
|
struct odb_source *odb_source_new(struct object_database *odb,
|
|
const char *path,
|
|
bool local)
|
|
{
|
|
struct odb_source *source;
|
|
|
|
CALLOC_ARRAY(source, 1);
|
|
source->odb = odb;
|
|
source->local = local;
|
|
source->path = xstrdup(path);
|
|
source->loose = odb_source_loose_new(source);
|
|
source->packfiles = packfile_store_new(source);
|
|
|
|
return source;
|
|
}
|
|
|
|
void odb_source_free(struct odb_source *source)
|
|
{
|
|
free(source->path);
|
|
odb_source_loose_free(source->loose);
|
|
packfile_store_free(source->packfiles);
|
|
free(source);
|
|
}
|