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

[PATCH 0/3] [2.51.0 Bug] Missing singleton objects in 'git repack -adf --path-walk'

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 20, 2025, 18:39 UTC
Message-ID
<pull.1956.git.1755715196.gitgitgadget@gmail.com>

Now that the --path-walk feature for git repack is out in the wild and getting more visibility than it did in the Git for Windows fork, the following issue was brought to my attention:

Some folks would report missing objects after git repack -adf --path-walk!

It turns out that this snuck through the cracks because it was pretty difficult to create a reproducing test case (patch 1) but it boils down to:

 1. A path has exactly one version across all of the history being repacked.
 2. That path is in the index.
 3. The object at that path is not a loose object.
 4. pack.useSparse=true in the config (this is the default)

It is also something where users don't necessarily notice the missing objects until they fetch and a missing object is used as a delta base. Doing normal checkouts doesn't cause changes to these files, so they are never opened by Git. Users hitting this issue can usually recover using git fetch --refetch to repopulate the missing objects from a remote (unless they never had a remote at all).

Patch 2 introduces the fix for this issue, which is related to forgetting to initialize a struct indicator when walking the pending objects.

When reflecting on the ways that I missed this when building the feature, I think the core issue was an overreliance on using bare repos in testing. I also think that the way that the UNINTERESTING object exploration was implemented was particularly fragile to missing updates to the initialization of the struct, so patch 3 adds a new initializer to reduce duplicate code and to help avoid this mistake in the future.

Thanks, -Stolee
P.S. CC'ing all original reviewers of the series.
Derrick Stolee (3):
  t7700: add failing --path-walk test
  path-walk: fix setup of pending objects
  path-walk: create initializer for path lists
 path-walk.c       | 55 +++++++++++++++++++++--------------------------
 t/t7700-repack.sh | 43 ++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 30 deletions(-)
base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1956%2Fderrickstolee%2Fpath-walk-missing-objects-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1956/derrickstolee/path-walk-missing-objects-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1956
-- 
gitgitgadget
Next: Derrick Stolee via GitGitGadget
Message 1 of 22 in “[2.51.0 Bug] Missing singleton objects in 'git repack -adf --path-walk'”
  1. 0/3 [2.51.0 Bug] Missing singleton objects in 'git repack -adf --path-walk'Derrick Stolee via GitGitGadget, Aug 20, 2025
  2. 1/3 t7700: add failing --path-walk testDerrick Stolee via GitGitGadget, Aug 20, 2025
  3. Patrick SteinhardtAug 21, 2025
  4. Derrick StoleeAug 21, 2025
  5. Junio C HamanoAug 21, 2025
  6. Elijah NewrenAug 21, 2025
  7. 2/3 path-walk: fix setup of pending objectsDerrick Stolee via GitGitGadget, Aug 20, 2025
  8. Junio C HamanoAug 20, 2025
  9. Derrick StoleeAug 20, 2025
  10. Patrick SteinhardtAug 21, 2025
  11. Derrick StoleeAug 21, 2025
  12. Patrick SteinhardtAug 21, 2025
  13. Derrick StoleeAug 21, 2025
  14. Elijah NewrenAug 21, 2025
  15. 3/3 path-walk: create initializer for path listsDerrick Stolee via GitGitGadget, Aug 20, 2025
  16. Elijah NewrenAug 21, 2025
  17. 0/2 [2.51.0 Bug] Missing singleton objects in 'git repack -adf --path-walk'Derrick Stolee via GitGitGadget, Aug 25, 2025
  18. 1/2 path-walk: fix setup of pending objectsDerrick Stolee via GitGitGadget, Aug 25, 2025
  19. 2/2 path-walk: create initializer for path listsDerrick Stolee via GitGitGadget, Aug 25, 2025
  20. Elijah NewrenAug 26, 2025
  21. Junio C HamanoAug 26, 2025
  22. Patrick SteinhardtSep 2, 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.