git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/7] Improvements for reading object info

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 7, 2026, 13:07 UTC
Message-ID
<20260107-b4-pks-odb-read-object-info-improvements-v4-0-b5d55c47082a@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 v4:
  - Extend the fix for OI_LOOSE and refactor the whole function to have
    a single exit path as proposed by Karthik. This results in a lot
    more changes, but makes the function way easier to reason about
    going forward.
  - Link to v3: https://lore.kernel.org/r/20260106-b4-pks-odb-read-object-info-improvements-v3-0-b5e02fae1fb0@pks.im
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.im
Thanks!
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          | 115 ++++++++++++++++++++++++++++++-------------------
 odb.h                  |   8 +++-
 pack-bitmap.c          |   3 +-
 packfile.c             |  61 +++++++++++++++-----------
 packfile.h             |   7 ++-
 8 files changed, 124 insertions(+), 79 deletions(-)
Range-diff versus v3:

1: 5c67d9abe8 < -: ---------- object-file: always set OI_LOOSE when reading object info -: ---------- > 1: 7708b50c2a object-file: always set OI_LOOSE when reading object info 2: 8b106feb28 = 2: a96ac5b351 packfile: always declare object info to be OI_PACKED 3: adbd3e5ae5 = 3: 8e3193a06e packfile: extend `is_delta` field to allow for "unknown" state 4: 218c64c9a5 = 4: e718161286 packfile: always populate pack-specific info when reading object info 5: dcae7be795 = 5: 217bec7e3b packfile: disentangle return value of `packed_object_info()` 6: beac514592 = 6: 2aaacfd639 packfile: skip unpacking object header for disk size requests 7: dacccf1cb4 = 7: a9e37b7e00 packfile: drop repository parameter from `packed_object_info()`

--- base-commit: 7df68b50e49b6a1b576abb19b2e5d457749bc28b change-id: 20251215-b4-pks-odb-read-object-info-improvements-0e031ef827d2

Previous: Karthik NayakNext: Patrick Steinhardt
Message 40 of 58 in “Improvements for reading object info”
  1. 0/8 Improvements for reading object infoPatrick Steinhardt, Dec 18, 2025
  2. 1/8 object-file: always set OI_LOOSE when reading object infoPatrick Steinhardt, Dec 18, 2025
  3. 2/8 packfile: always declare object info to be OI_PACKEDPatrick Steinhardt, Dec 18, 2025
  4. Junio C HamanoDec 18, 2025
  5. Patrick SteinhardtDec 18, 2025
  6. 3/8 packfile: extend `is_delta` field to allow for "unknown" statePatrick Steinhardt, Dec 18, 2025
  7. 4/8 packfile: always populate pack-specific info when reading object infoPatrick Steinhardt, Dec 18, 2025
  8. Junio C HamanoDec 18, 2025
  9. 5/8 packfile: disentangle return value of `packed_object_info()`Patrick Steinhardt, Dec 18, 2025
  10. 6/8 packfile: skip unpacking object header for disk size requestsPatrick Steinhardt, Dec 18, 2025
  11. 7/8 packfile: fix short-circuiting of empty requestsPatrick Steinhardt, Dec 18, 2025
  12. 8/8 packfile: drop repository parameter from `packed_object_info()`Patrick Steinhardt, Dec 18, 2025
  13. Junio C HamanoDec 18, 2025
  14. Patrick SteinhardtDec 18, 2025
  15. 0/7 Improvements for reading object infoPatrick Steinhardt, Dec 18, 2025
  16. 1/7 object-file: always set OI_LOOSE when reading object infoPatrick Steinhardt, Dec 18, 2025
  17. 2/7 packfile: always declare object info to be OI_PACKEDPatrick Steinhardt, Dec 18, 2025
  18. Toon ClaesJan 5, 2026
  19. 3/7 packfile: extend `is_delta` field to allow for "unknown" statePatrick Steinhardt, Dec 18, 2025
  20. Toon ClaesJan 5, 2026
  21. Patrick SteinhardtJan 6, 2026
  22. 4/7 packfile: always populate pack-specific info when reading object infoPatrick Steinhardt, Dec 18, 2025
  23. Kristoffer HaugsbakkDec 30, 2025
  24. Patrick SteinhardtJan 5, 2026
  25. 5/7 packfile: disentangle return value of `packed_object_info()`Patrick Steinhardt, Dec 18, 2025
  26. 6/7 packfile: skip unpacking object header for disk size requestsPatrick Steinhardt, Dec 18, 2025
  27. 7/7 packfile: drop repository parameter from `packed_object_info()`Patrick Steinhardt, Dec 18, 2025
  28. 0/7 Improvements for reading object infoPatrick Steinhardt, Jan 6, 2026
  29. 1/7 object-file: always set OI_LOOSE when reading object infoPatrick Steinhardt, Jan 6, 2026
  30. Karthik NayakJan 7, 2026
  31. Patrick SteinhardtJan 7, 2026
  32. 2/7 packfile: always declare object info to be OI_PACKEDPatrick Steinhardt, Jan 6, 2026
  33. 3/7 packfile: extend `is_delta` field to allow for "unknown" statePatrick Steinhardt, Jan 6, 2026
  34. Karthik NayakJan 7, 2026
  35. 4/7 packfile: always populate pack-specific info when reading object infoPatrick Steinhardt, Jan 6, 2026
  36. 5/7 packfile: disentangle return value of `packed_object_info()`Patrick Steinhardt, Jan 6, 2026
  37. 6/7 packfile: skip unpacking object header for disk size requestsPatrick Steinhardt, Jan 6, 2026
  38. 7/7 packfile: drop repository parameter from `packed_object_info()`Patrick Steinhardt, Jan 6, 2026
  39. Karthik NayakJan 7, 2026
  40. 0/7 Improvements for reading object infoPatrick Steinhardt, Jan 7, 2026
  41. 1/7 object-file: always set OI_LOOSE when reading object infoPatrick Steinhardt, Jan 7, 2026
  42. Karthik NayakJan 8, 2026
  43. 2/7 packfile: always declare object info to be OI_PACKEDPatrick Steinhardt, Jan 7, 2026
  44. 3/7 packfile: extend `is_delta` field to allow for "unknown" statePatrick Steinhardt, Jan 7, 2026
  45. 4/7 packfile: always populate pack-specific info when reading object infoPatrick Steinhardt, Jan 7, 2026
  46. 5/7 packfile: disentangle return value of `packed_object_info()`Patrick Steinhardt, Jan 7, 2026
  47. 6/7 packfile: skip unpacking object header for disk size requestsPatrick Steinhardt, Jan 7, 2026
  48. 7/7 packfile: drop repository parameter from `packed_object_info()`Patrick Steinhardt, Jan 7, 2026
  49. Karthik NayakJan 8, 2026
  50. 0/7 Improvements for reading object infoPatrick Steinhardt, Jan 12, 2026
  51. 1/7 object-file: always set OI_LOOSE when reading object infoPatrick Steinhardt, Jan 12, 2026
  52. 2/7 packfile: always declare object info to be OI_PACKEDPatrick Steinhardt, Jan 12, 2026
  53. Junio C HamanoJan 12, 2026
  54. 3/7 packfile: extend `is_delta` field to allow for "unknown" statePatrick Steinhardt, Jan 12, 2026
  55. 4/7 packfile: always populate pack-specific info when reading object infoPatrick Steinhardt, Jan 12, 2026
  56. 5/7 packfile: disentangle return value of `packed_object_info()`Patrick Steinhardt, Jan 12, 2026
  57. 6/7 packfile: skip unpacking object header for disk size requestsPatrick Steinhardt, Jan 12, 2026
  58. 7/7 packfile: drop repository parameter from `packed_object_info()`Patrick Steinhardt, Jan 12, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.