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

[PATCH 0/3] Fix REF_DELTA chain bug in 'git index-pack'

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 23, 2025, 17:40 UTC
Message-ID
<pull.1906.git.1745430004.gitgitgadget@gmail.com>

When fetching content from a remote, 'git index-pack' processes the packfile content, storing a packfile appropriate for on-disk storage and a pack-index helping to perform random-access into that packfile. To help with compression, the packfile sent over the wire can use REF_DELTAs in addition to OFS_DELTAs to refer to objects that are already known to exist in the client's repository. REF_DELTAs can also refer to objects within the packfile, though this is not typically done.

Because this inter-pack REF_DELTA is not a typical data shape, a latent bug has been waiting that causes 'git index-pack' to die() even on legitimate packfile content that it could resolve.

This series resolves this problem while also creating a test helper for constructing packfiles with specific objects represented in specific types of deltas and in a given order. This should make it easier to create test cases like this in the future instead of updating t/lib-pack.sh through other means.

Thanks, -Stolee
Derrick Stolee (3):
  test-tool: add pack-deltas helper
  t5309: create failing test for 'git index-pack'
  index-pack: allow revisiting REF_DELTA chains
 Makefile                     |   1 +
 builtin/index-pack.c         |  58 ++++++++-------
 t/helper/meson.build         |   1 +
 t/helper/test-pack-deltas.c  | 140 +++++++++++++++++++++++++++++++++++
 t/helper/test-tool.c         |   1 +
 t/helper/test-tool.h         |   1 +
 t/t5309-pack-delta-cycles.sh |  36 ++++++++-
 7 files changed, 210 insertions(+), 28 deletions(-)
 create mode 100644 t/helper/test-pack-deltas.c
base-commit: 4bbb303af69990ccd05fe3a2eb58a1ce036f8220
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1906%2Fderrickstolee%2Findex-pack-ref-deltas-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1906/derrickstolee/index-pack-ref-deltas-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1906
-- 
gitgitgadget
Next: Derrick Stolee via GitGitGadget
Message 1 of 29 in “Fix REF_DELTA chain bug in 'git index-pack'”
  1. 0/3 Fix REF_DELTA chain bug in 'git index-pack'Derrick Stolee via GitGitGadget, Apr 23, 2025
  2. 1/3 test-tool: add pack-deltas helperDerrick Stolee via GitGitGadget, Apr 23, 2025
  3. Junio C HamanoApr 23, 2025
  4. Derrick StoleeApr 23, 2025
  5. Junio C HamanoApr 24, 2025
  6. Derrick StoleeApr 24, 2025
  7. Junio C HamanoApr 24, 2025
  8. Patrick SteinhardtApr 25, 2025
  9. Johannes SchindelinApr 25, 2025
  10. Patrick SteinhardtApr 25, 2025
  11. Johannes SchindelinApr 25, 2025
  12. Junio C HamanoApr 25, 2025
  13. Derrick StoleeApr 28, 2025
  14. Junio C HamanoApr 28, 2025
  15. Derrick StoleeApr 28, 2025
  16. Junio C HamanoApr 28, 2025
  17. 2/3 t5309: create failing test for 'git index-pack'Derrick Stolee via GitGitGadget, Apr 23, 2025
  18. Junio C HamanoApr 23, 2025
  19. 3/3 index-pack: allow revisiting REF_DELTA chainsDerrick Stolee via GitGitGadget, Apr 23, 2025
  20. Junio C HamanoApr 24, 2025
  21. Derrick StoleeApr 25, 2025
  22. 0/3 Fix REF_DELTA chain bug in 'git index-pack'Derrick Stolee via GitGitGadget, Apr 28, 2025
  23. 1/3 test-tool: add pack-deltas helperDerrick Stolee via GitGitGadget, Apr 28, 2025
  24. 2/3 t5309: create failing test for 'git index-pack'Derrick Stolee via GitGitGadget, Apr 28, 2025
  25. 3/3 index-pack: allow revisiting REF_DELTA chainsDerrick Stolee via GitGitGadget, Apr 28, 2025
  26. Taylor BlauMay 7, 2025
  27. Derrick StoleeMay 7, 2025
  28. Junio C HamanoApr 28, 2025
  29. Patrick SteinhardtApr 29, 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.