Git development
 help / color / mirror / Atom feed
* [PATCH 0/7] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically
@ 2026-08-18 14:19 Patrick Steinhardt
  2026-08-18 14:19 ` [PATCH 1/7] odb/source: discern missing and corrupt objects Patrick Steinhardt
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Patrick Steinhardt @ 2026-08-18 14:19 UTC (permalink / raw)
  To: git

Hi,

when looking up an object with `OBJECT_INFO_DIE_IF_CORRUPT` fails we
want to die in case the object exists but is corrupted. This flag is
handled in two different spots right now:

  - `do_oid_object_info_extended()` calls `has_packed_and_bad()` to
    check whether the object is known to be corrupt in any packfile.
    This function reaches into the internals of the packed source and
    thus breaks the abstraction provided by our object sources.

  - The loose source handles the flag itself and dies directly in
    `read_object_info_from_path()`, which means that we die even in
    cases where another source may still have a good copy of the
    object.

Besides being inconsistent, it also ties us to the specific backend used
by the database sources because `has_packed_and_bad()` assumes that they
use the "files" backend. Any other backend will instead cause us to die
when calling `odb_source_files_downcast()`, even if the object was
simply nonexistent.

This series fixes these issues and makes the check backend-agnostic by
extending semantics of `odb_source_read_object_info()`: on the one hand
it now distinguishes whether an object is missing or corrput, and on the
other hand it starts to return an error message to the caller.

Thanks!

Patrick

---
Patrick Steinhardt (7):
      odb/source: discern missing and corrupt objects
      odb/source-inmemory: signal missing objects via positive return
      odb/source-packed: flag known-bad objects as corrupt and not missing
      odb/source-loose: distinguish missing and corrupt objects
      odb/source-files: signal mark objects via positive return
      odb/source: allow `read_object_info()` to bubble up error messages
      odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically

 builtin/pack-objects.c        |  8 +++----
 midx.c                        | 10 +++++---
 midx.h                        |  3 ++-
 odb.c                         | 47 ++++++++++++++++++++++++++------------
 odb/source-files.c            | 25 ++++++++++++++++----
 odb/source-inmemory.c         |  5 ++--
 odb/source-loose.c            | 46 +++++++++++++++++++++----------------
 odb/source-packed.c           | 53 +++++++++++++++++++++++++++++++++----------
 odb/source.h                  | 33 ++++++++++++++++++++++-----
 packfile.c                    | 29 +++++++----------------
 packfile.h                    |  4 ++--
 t/helper/test-read-midx.c     |  2 +-
 t/t1060-object-corruption.sh  | 18 +++++++++++++++
 t/unit-tests/u-odb-inmemory.c |  4 ++--
 14 files changed, 196 insertions(+), 91 deletions(-)


---
base-commit: 18e66859d87fb4b76599f73460b54f0848c76b16
change-id: 20260818-pks-odb-generic-corrupt-objects-52a47d6214d9


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-08-18 18:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 14:19 [PATCH 0/7] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 1/7] odb/source: discern missing and corrupt objects Patrick Steinhardt
2026-08-18 18:00   ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 2/7] odb/source-inmemory: signal missing objects via positive return Patrick Steinhardt
2026-08-18 18:05   ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 3/7] odb/source-packed: flag known-bad objects as corrupt and not missing Patrick Steinhardt
2026-08-18 18:17   ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 4/7] odb/source-loose: distinguish missing and corrupt objects Patrick Steinhardt
2026-08-18 18:23   ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 5/7] odb/source-files: signal mark objects via positive return Patrick Steinhardt
2026-08-18 18:58   ` Junio C Hamano
2026-08-18 14:19 ` [PATCH 6/7] odb/source: allow `read_object_info()` to bubble up error messages Patrick Steinhardt
2026-08-18 14:19 ` [PATCH 7/7] odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox