MCPcopy Create free account
hub / github.com/git/git / odb_new

Function odb_new

odb.c:1006–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006struct object_database *odb_new(struct repository *repo,
1007 const char *primary_source,
1008 const char *secondary_sources)
1009{
1010 struct object_database *o = xmalloc(sizeof(*o));
1011 char *to_free = NULL;
1012
1013 memset(o, 0, sizeof(*o));
1014 o->repo = repo;
1015 pthread_mutex_init(&o->replace_mutex, NULL);
1016 string_list_init_dup(&o->submodule_source_paths);
1017
1018 if (!primary_source)
1019 primary_source = to_free = xstrfmt("%s/objects", repo->commondir);
1020 o->sources = odb_source_new(o, primary_source, true);
1021 o->sources_tail = &o->sources->next;
1022 o->alternate_db = xstrdup_or_null(secondary_sources);
1023 o->inmemory_objects = &odb_source_inmemory_new(o)->base;
1024
1025 free(to_free);
1026
1027 return o;
1028}
1029
1030void odb_close(struct object_database *o)
1031{

Callers 2

apply_repository_formatFunction · 0.85

Calls 6

string_list_init_dupFunction · 0.85
xstrfmtFunction · 0.85
odb_source_newFunction · 0.85
xstrdup_or_nullFunction · 0.85
odb_source_inmemory_newFunction · 0.85
xmallocFunction · 0.70

Tested by 1