[PATCH v3 0/7] Improvements for reading object info
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 6, 2026, 06:54 UTC
- Message-ID
- <20260106-b4-pks-odb-read-object-info-improvements-v3-0-b5e02fae1fb0@pks.im>
- In-Reply-To
- <20251218-b4-pks-odb-read-object-info-improvements-v1-0-81c8368492be@pks.im>
Hi,
this patch series contains various small improvements for reading object info for either loose or packed objects. These improvements were split out of a larger patch series where I'm about to introduce a new generic `odb_for_each_object()` function.
Changes in v3: - Fix a commit message typo. - Fix a function comment missing some words. - Link to v2: https://lore.kernel.org/r/20251218-b4-pks-odb-read-object-info-improvements-v2-0-62e3e49072bc@pks.im
Changes in v2:
- Rebase the series on top of master with jc/object-read-stream-fix
merged into it. I've also evicted the patch that fixes the same
underlying issue.
- Improve the commit message that drops OI_DBCACHED to explain why
this is a safe refactoring.
- Link to v1: https://lore.kernel.org/r/20251218-b4-pks-odb-read-object-info-improvements-v1-0-81c8368492be@pks.imThanks!
Patrick
---
Patrick Steinhardt (7):
object-file: always set OI_LOOSE when reading object info
packfile: always declare object info to be OI_PACKED
packfile: extend `is_delta` field to allow for "unknown" state
packfile: always populate pack-specific info when reading object info
packfile: disentangle return value of `packed_object_info()`
packfile: skip unpacking object header for disk size requests
packfile: drop repository parameter from `packed_object_info()`builtin/cat-file.c | 3 +-- builtin/pack-objects.c | 4 ++-- commit-graph.c | 2 +- object-file.c | 19 ++++++++++++---- odb.h | 8 +++++-- pack-bitmap.c | 3 +-- packfile.c | 61 ++++++++++++++++++++++++++++++-------------------- packfile.h | 7 ++++-- 8 files changed, 68 insertions(+), 39 deletions(-)
Range-diff versus v2:
1: 8b6b891c2f = 1: 9efc7d00c1 object-file: always set OI_LOOSE when reading object info
2: b83dd3d689 = 2: efd29f0e27 packfile: always declare object info to be OI_PACKED
3: 6815b23dd7 ! 3: 1448cd37b3 packfile: extend `is_delta` field to allow for "unknown" state
@@ Commit message
Prepare for this change by introducing a new enum that encodes the
object type. We don't use the "unknown" state just yet, but will start
- to do so in the next commit.
+ to do so in a subsequent commit.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
4: ec18d71d07 ! 4: 8eb063df04 packfile: always populate pack-specific info when reading object info
@@ Commit message
inconsistent object info depending on whether the info was populated via
`packfile_store_read_object_info()` or `packed_object_info()`.
- Fix this inconsistecny so that we can always assume the pack info to be
+ Fix this inconsistency so that we can always assume the pack info to be
populated when reading object info from a pack.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
5: cc0694bb0f ! 5: 33582ef5e0 packfile: disentangle return value of `packed_object_info()`
@@ packfile.h: void release_pack_memory(size_t);
+/*
+ * Look up the object info for a specific offset in the packfile.
-+ * success, a negative error code otherwise.
++ * Returns zero on success, a negative error code otherwise.
+ */
int packed_object_info(struct repository *r,
struct packed_git *pack,
6: 98eee570b8 = 6: 42ec9b8170 packfile: skip unpacking object header for disk size requests
7: 9c9e71d7b2 ! 7: 03bc55e74f packfile: drop repository parameter from `packed_object_info()`
@@ packfile.c: int packfile_store_read_object_info(struct packfile_store *store,
## packfile.h ##
@@ packfile.h: extern int do_check_packed_object_crc;
* Look up the object info for a specific offset in the packfile.
- * success, a negative error code otherwise.
+ * Returns zero on success, a negative error code otherwise.
*/
-int packed_object_info(struct repository *r,
- struct packed_git *pack,--- base-commit: 7df68b50e49b6a1b576abb19b2e5d457749bc28b change-id: 20251215-b4-pks-odb-read-object-info-improvements-0e031ef827d2