diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-08-19 14:17:20 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-19 10:23:02 -0700 |
| commit | d55f3629e613af08c3520b65b7a13d030134be6e (patch) | |
| tree | 507f9df3a5acee85dc0411675a8dd330eaba7078 /t/t4013/diff.diff_initial..side | |
| parent | 47ef2193b319d7ee4fffbcbd56ba912420a3460a (diff) | |
odb/source: introduce error status when reading objects
The `read_object_info()` callback of `struct odb_source` is documented
to return a negative error code in case reading the object has failed,
and zero otherwise. This is overly broad though, as there are two very
different kinds of failures:
- The object may not exist in the source at all.
- The object exists, but reading it has failed, for example because
its on-disk state is corrupt.
This distinction matters to callers: when an object is corrupt in one
source we may still find a good copy of it in another source, so we may
still be able to proceed with a given operation.
The "packed" source already distinguishes these cases by returning a
positive value for missing objects and a negative value in case reading
the object has failed. But it is the only such source that distinguishes
those cases, and the returned value is translated into a negative error
code by the "files" backend anyway.
Introduce a new error status that is specific to reading objects and
adapt the infrastructure to return it. For now, we only discern
successful reads from generic failures, which mostly matches the status
quo. In subsequent commits though we're about to add an error that
explicitly tells the caller that an object does not exist.
Note that we keep the "packed" backend as-is with its positive return
code for missing objects. This will be fixed in the next commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
