diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-03-05 15:19:45 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-05 11:45:15 -0800 |
| commit | 87842f68352040858f581b64509932fb91c64f0f (patch) | |
| tree | c94012f8d76c89ea5750289c504a7d179ac8e75a /odb/source-files.c | |
| parent | 7e0aa0ab803405076b82ca66d328d314d17870ac (diff) | |
| download | git-87842f68352040858f581b64509932fb91c64f0f.tar.xz | |
odb/source: introduce source type for robustness
When a caller holds a `struct odb_source`, they have no way of telling
what type the source is. This doesn't really cause any problems in the
current status quo as we only have a single type anyway, "files". But
going forward we expect to add more types, and if so it will become
necessary to tell the sources apart.
Introduce a new enum to cover this use case and assert that the given
source actually matches the target source when performing the downcast.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb/source-files.c')
| -rw-r--r-- | odb/source-files.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odb/source-files.c b/odb/source-files.c index df0ea9ee62..7496e1d9f8 100644 --- a/odb/source-files.c +++ b/odb/source-files.c @@ -36,7 +36,7 @@ struct odb_source_files *odb_source_files_new(struct object_database *odb, struct odb_source_files *files; CALLOC_ARRAY(files, 1); - odb_source_init(&files->base, odb, path, local); + odb_source_init(&files->base, odb, ODB_SOURCE_FILES, path, local); files->loose = odb_source_loose_new(&files->base); files->packed = packfile_store_new(&files->base); |
