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

Re: [PATCH 2/3] path-walk: fix setup of pending objects

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 20, 2025, 19:02 UTC
Message-ID
<xmqqh5y1ak9o.fsf@gitster.g>
In-Reply-To
<0dc4a6323e66598070b403d286ee1918e6a9b791.1755715196.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> The core problem here is that the "maybe_interesting" member of 'struct
> type_and_oid_list' is not initialized to '1'. This member was added in
> 6333e7ae0b (path-walk: mark trees and blobs as UNINTERESTING,
> 2024-12-20) in a way to help when creating packfiles for a small commit
> range using the sparse path algorithm (enabled by pack.useSparse=true).

OK, in other words, the bug is fairly contained within the path-walk traversal. We treat things as reachable not just from ref tips and reflogs (where path-walk code can use the tree object to compute on what pathname each blob comes from) and the main index array (that has paths, even though it needs separate way to compute than those for trees), but also from places like REUC and TREE extensions that make associations between pathnames and objects. Are they also OK?

> To help avoid this from happening in the future, a follow-up change will
> make initializing lists use a shared method instead of allowing for an
> update to this initialization process to miss some existing copies.
Great.  Future-proofing is 100 times better than just a bugfix.
Show 40 quoted lines
>
> Signed-off-by: Derrick Stolee <stolee@gmail.com>
> ---
>  path-walk.c       | 2 ++
>  t/t7700-repack.sh | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/path-walk.c b/path-walk.c
> index 2d4ddbadd50f..1215ed398f4f 100644
> --- a/path-walk.c
> +++ b/path-walk.c
> @@ -385,6 +385,7 @@ static int setup_pending_objects(struct path_walk_info *info,
>  					list->type = OBJ_TREE;
>  					strmap_put(&ctx->paths_to_lists, path, list);
>  				}
> +				list->maybe_interesting = 1;
>  				oid_array_append(&list->oids, &obj->oid);
>  				free(path);
>  			} else {
> @@ -404,6 +405,7 @@ static int setup_pending_objects(struct path_walk_info *info,
>  					list->type = OBJ_BLOB;
>  					strmap_put(&ctx->paths_to_lists, path, list);
>  				}
> +				list->maybe_interesting = 1;
>  				oid_array_append(&list->oids, &obj->oid);
>  			} else {
>  				/* assume a root tree, such as a lightweight tag. */
> diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
> index 1998d9bf291c..030e9e5b2dc7 100755
> --- a/t/t7700-repack.sh
> +++ b/t/t7700-repack.sh
> @@ -838,7 +838,7 @@ test_expect_success '-n overrides repack.updateServerInfo=true' '
>  	test_server_info_missing
>  '
>  
> -test_expect_failure 'pending objects are repacked appropriately' '
> +test_expect_success 'pending objects are repacked appropriately' '
>  	git init pending &&
>  
>  	(
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee
Message 8 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.