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

[PATCH 0/5] midx: improve prepare_midx_pack() ergonomics

From
Taylor Blau <me@ttaylorr.com>
Date
May 25, 2025, 18:41 UTC
Message-ID
<cover.1748198489.git.me@ttaylorr.com>
In-Reply-To
<aDC0bK+NOuuVvQtb@nand.local>
[This brief series is based on ps/midx-negative-packfile-cache].

This series implements a suggestion from this thread to have prepare_midx_pack() return a pointer to packed_git structure identified by the given pack_int_id.

This convention makes converting a pack_int_id into a bona-fide pack significantly less error-prone, particularly when dealing with incremental MIDXs.

Along the way, I noticed a couple of opportunities for clean-up and light refactorings, which make up the first four patches.

In the future, I think we could take this further by:
  - applying the same pattern to the 'pack_names' array, and
  - renaming both arrays something like 'packs_' or similar to indicate
    that they are "private" and should not be accessed outside of
    midx.c.

We might be able to go even further than that by making the entire structure opaque to external callers by defining it within midx.c itself. We don't get there in this series, but it sets us on the right direction.

Thanks in advance for your review!
Taylor Blau (5):
  pack-bitmap.c: fix broken warning() when missing MIDX'd pack
  midx-write.c: guard against incremental MIDXs in want_included_pack()
  midx-write.c: simplify fill_packs_from_midx()
  midx-write.c: extract inner loop from fill_packs_from_midx()
  midx: return a `packed_git` pointer from `prepare_midx_pack()`
 midx-write.c  | 114 +++++++++++++++++++++++++++++++-------------------
 midx.c        |  81 ++++++++++++++++++-----------------
 midx.h        |   4 +-
 pack-bitmap.c |   4 +-
 4 files changed, 115 insertions(+), 88 deletions(-)
base-commit: 73fe0882eec06f7b9ea021fe062a32cd1731e574
-- 
2.49.0.641.gb9c9c4c3bd
Previous: Taylor BlauNext: Taylor Blau
Message 20 of 53 in “packfile: avoid access(3p) calls for missing packs”
  1. packfile: avoid access(3p) calls for missing packsPatrick Steinhardt, May 16, 2025
  2. Junio C HamanoMay 16, 2025
  3. Jeff KingMay 19, 2025
  4. Junio C HamanoMay 19, 2025
  5. Patrick SteinhardtMay 20, 2025
  6. Jeff KingMay 22, 2025
  7. Taylor BlauMay 23, 2025
  8. Jeff KingMay 23, 2025
  9. 0/2 packfile: avoid access(3p) calls for missing packsPatrick Steinhardt, May 20, 2025
  10. 1/2 packfile: explain ordering of how we look up auxiliary pack filesPatrick Steinhardt, May 20, 2025
  11. Taylor BlauMay 23, 2025
  12. 2/2 midx: stop repeatedly looking up nonexistent packfilesPatrick Steinhardt, May 20, 2025
  13. Jeff KingMay 22, 2025
  14. Junio C HamanoMay 22, 2025
  15. Jeff KingMay 22, 2025
  16. Junio C HamanoMay 22, 2025
  17. Taylor BlauMay 23, 2025
  18. Jeff KingMay 23, 2025
  19. Taylor BlauMay 23, 2025
  20. 0/5 midx: improve prepare_midx_pack() ergonomicsTaylor Blau, May 25, 2025
  21. 1/5 pack-bitmap.c: fix broken warning() when missing MIDX'd packTaylor Blau, May 25, 2025
  22. Patrick SteinhardtMay 26, 2025
  23. Taylor BlauMay 28, 2025
  24. 2/5 midx-write.c: guard against incremental MIDXs in want_included_pack()Taylor Blau, May 25, 2025
  25. Patrick SteinhardtMay 26, 2025
  26. Taylor BlauMay 28, 2025
  27. 3/5 midx-write.c: simplify fill_packs_from_midx()Taylor Blau, May 25, 2025
  28. Patrick SteinhardtMay 26, 2025
  29. Taylor BlauMay 28, 2025
  30. 4/5 midx-write.c: extract inner loop from fill_packs_from_midx()Taylor Blau, May 25, 2025
  31. 5/5 midx: return a `packed_git` pointer from `prepare_midx_pack()`Taylor Blau, May 25, 2025
  32. Patrick SteinhardtMay 26, 2025
  33. Taylor BlauMay 28, 2025
  34. Patrick SteinhardtMay 28, 2025
  35. 0/4 midx: improve prepare_midx_pack() ergonomicsTaylor Blau, May 28, 2025
  36. 1/4 midx: access pack names through `nth_midxed_pack_name()`Taylor Blau, May 28, 2025
  37. Junio C HamanoMay 29, 2025
  38. Taylor BlauJun 3, 2025
  39. Junio C HamanoMay 29, 2025
  40. Taylor BlauJun 3, 2025
  41. 2/4 midx-write.c: guard against incremental MIDXs in want_included_pack()Taylor Blau, May 28, 2025
  42. 3/4 midx-write.c: extract inner loop from fill_packs_from_midx()Taylor Blau, May 28, 2025
  43. 4/4 midx: return a `packed_git` pointer from `prepare_midx_pack()`Taylor Blau, May 28, 2025
  44. Jeff KingMay 30, 2025
  45. Taylor BlauJun 3, 2025
  46. Junio C HamanoAug 28, 2025
  47. Taylor BlauMay 23, 2025
  48. Jeff KingMay 23, 2025
  49. Junio C HamanoMay 21, 2025
  50. 0/2 packfile: avoid access(3p) calls for missing packsPatrick Steinhardt, May 28, 2025
  51. 2/2 midx: stop repeatedly looking up nonexistent packfilesPatrick Steinhardt, May 28, 2025
  52. 1/2 packfile: explain ordering of how we look up auxiliary pack filesPatrick Steinhardt, May 28, 2025
  53. Jeff KingMay 30, 2025

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.