diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-03-10 10:13:40 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-10 10:13:40 -0700 |
| commit | 6cdef943d28fa7d6964ec570b33a0bff4c80ea8c (patch) | |
| tree | a0e3158cc93a48d1b2c7c77747536f0bd39a0165 /odb/source.c | |
| parent | d181b9354cf85b44455ce3ca9e6af0b9559e0ae2 (diff) | |
| parent | d6fc6fe6f8b74e663d6013f830b535f50bfc1414 (diff) | |
| download | git-6cdef943d28fa7d6964ec570b33a0bff4c80ea8c.tar.xz | |
Merge branch 'ps/odb-sources' into ps/object-counting
* ps/odb-sources:
odb/source: make `begin_transaction()` function pluggable
odb/source: make `write_alternate()` function pluggable
odb/source: make `read_alternates()` function pluggable
odb/source: make `write_object_stream()` function pluggable
odb/source: make `write_object()` function pluggable
odb/source: make `freshen_object()` function pluggable
odb/source: make `for_each_object()` function pluggable
odb/source: make `read_object_stream()` function pluggable
odb/source: make `read_object_info()` function pluggable
odb/source: make `close()` function pluggable
odb/source: make `reprepare()` function pluggable
odb/source: make `free()` function pluggable
odb/source: introduce source type for robustness
odb: move reparenting logic into respective subsystems
odb: embed base source in the "files" backend
odb: introduce "files" source
odb: split `struct odb_source` into separate header
Diffstat (limited to 'odb/source.c')
| -rw-r--r-- | odb/source.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/odb/source.c b/odb/source.c new file mode 100644 index 0000000000..7993dcbd65 --- /dev/null +++ b/odb/source.c @@ -0,0 +1,38 @@ +#include "git-compat-util.h" +#include "object-file.h" +#include "odb/source-files.h" +#include "odb/source.h" +#include "packfile.h" + +struct odb_source *odb_source_new(struct object_database *odb, + const char *path, + bool local) +{ + return &odb_source_files_new(odb, path, local)->base; +} + +void odb_source_init(struct odb_source *source, + struct object_database *odb, + enum odb_source_type type, + const char *path, + bool local) +{ + source->odb = odb; + source->type = type; + source->local = local; + source->path = xstrdup(path); +} + +void odb_source_free(struct odb_source *source) +{ + if (!source) + return; + source->free(source); +} + +void odb_source_release(struct odb_source *source) +{ + if (!source) + return; + free(source->path); +} |
