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

Re: [PATCH v3 3/9] pack-objects: factor out handling '--stdin-packs'

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 16, 2025, 00:59 UTC
Message-ID
<xmqqplhckjju.fsf@gitster.g>
In-Reply-To
<6f8fe8a4e10198b0339337376279cff4ac654879.1744757204.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 14 quoted lines
> At the bottom of cmd_pack_objects() we check which mode the command is
> running in (e.g., generating a cruft pack, handling '--stdin-packs',
> using the internal rev-list, etc.) and handle the mode appropriately.
>
> The '--stdin-packs' case is handled inline (dating back to its
> introduction in 339bce27f4 (builtin/pack-objects.c: add '--stdin-packs'
> option, 2021-02-22)) since it is relatively short. Extract the body of
> "if (stdin_packs)" into its own function to prepare for the
> implementation to become lengthier in a following commit.
>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
>  builtin/pack-objects.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
Makes sense.
Show 44 quoted lines
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 4ab695a3aa..a293267074 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -3674,6 +3674,17 @@ static void read_packs_list_from_stdin(void)
>  	string_list_clear(&exclude_packs, 0);
>  }
>  
> +static void add_unreachable_loose_objects(void);
> +
> +static void read_stdin_packs(int rev_list_unpacked)
> +{
> +	/* avoids adding objects in excluded packs */
> +	ignore_packed_keep_in_core = 1;
> +	read_packs_list_from_stdin();
> +	if (rev_list_unpacked)
> +		add_unreachable_loose_objects();
> +}
> +
>  static void add_cruft_object_entry(const struct object_id *oid, enum object_type type,
>  				   struct packed_git *pack, off_t offset,
>  				   const char *name, uint32_t mtime)
> @@ -3769,7 +3780,6 @@ static void mark_pack_kept_in_core(struct string_list *packs, unsigned keep)
>  	}
>  }
>  
> -static void add_unreachable_loose_objects(void);
>  static void add_objects_in_unpacked_packs(void);
>  
>  static void enumerate_cruft_objects(void)
> @@ -4776,11 +4786,7 @@ int cmd_pack_objects(int argc,
>  		progress_state = start_progress(the_repository,
>  						_("Enumerating objects"), 0);
>  	if (stdin_packs) {
> -		/* avoids adding objects in excluded packs */
> -		ignore_packed_keep_in_core = 1;
> -		read_packs_list_from_stdin();
> -		if (rev_list_unpacked)
> -			add_unreachable_loose_objects();
> +		read_stdin_packs(rev_list_unpacked);
>  	} else if (cruft) {
>  		read_cruft_objects();
>  	} else if (!use_internal_rev_list) {
Previous: Taylor BlauNext: Taylor Blau
Message 45 of 105 in “repack: avoid MIDX'ing cruft pack(s) where possible”
  1. 0/8 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, Apr 11, 2025
  2. 1/8 pack-objects: use standard option incompatibility functionsTaylor Blau, Apr 11, 2025
  3. 2/8 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, Apr 11, 2025
  4. 3/8 pack-objects: factor out handling '--stdin-packs'Taylor Blau, Apr 11, 2025
  5. 4/8 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, Apr 11, 2025
  6. 5/8 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, Apr 11, 2025
  7. 6/8 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, Apr 11, 2025
  8. 7/8 repack: keep track of existing MIDX'd packsTaylor Blau, Apr 11, 2025
  9. 8/8 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, Apr 11, 2025
  10. 0/8 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, Apr 14, 2025
  11. 1/8 pack-objects: use standard option incompatibility functionsTaylor Blau, Apr 14, 2025
  12. Junio C HamanoApr 14, 2025
  13. Taylor BlauApr 15, 2025
  14. Junio C HamanoApr 15, 2025
  15. Taylor BlauApr 15, 2025
  16. 2/8 object-store-ll.h: add note about designated initializersTaylor Blau, Apr 14, 2025
  17. Junio C HamanoApr 14, 2025
  18. Taylor BlauApr 15, 2025
  19. Elijah NewrenApr 15, 2025
  20. Taylor BlauApr 15, 2025
  21. 3/8 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, Apr 14, 2025
  22. Elijah NewrenApr 15, 2025
  23. 4/8 pack-objects: factor out handling '--stdin-packs'Taylor Blau, Apr 14, 2025
  24. 5/8 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, Apr 14, 2025
  25. 6/8 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, Apr 14, 2025
  26. Elijah NewrenApr 15, 2025
  27. Taylor BlauApr 15, 2025
  28. 7/8 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, Apr 14, 2025
  29. Elijah NewrenApr 15, 2025
  30. Taylor BlauApr 15, 2025
  31. Elijah NewrenApr 16, 2025
  32. 8/8 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, Apr 14, 2025
  33. Elijah NewrenApr 15, 2025
  34. Taylor BlauApr 15, 2025
  35. Elijah NewrenApr 15, 2025
  36. Taylor BlauApr 15, 2025
  37. 0/9 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, Apr 15, 2025
  38. 1/9 pack-objects: use standard option incompatibility functionsTaylor Blau, Apr 15, 2025
  39. 2/9 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, Apr 15, 2025
  40. Junio C HamanoApr 16, 2025
  41. Taylor BlauApr 16, 2025
  42. Elijah NewrenApr 16, 2025
  43. Taylor BlauApr 16, 2025
  44. 3/9 pack-objects: factor out handling '--stdin-packs'Taylor Blau, Apr 15, 2025
  45. Junio C HamanoApr 16, 2025
  46. 4/9 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, Apr 15, 2025
  47. 5/9 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, Apr 15, 2025
  48. Junio C HamanoApr 16, 2025
  49. 6/9 pack-objects: fix typo in 'show_object_pack_hint()'Taylor Blau, Apr 15, 2025
  50. Elijah NewrenApr 16, 2025
  51. 7/9 pack-objects: swap 'show_{object,commit}_pack_hint'Taylor Blau, Apr 15, 2025
  52. 8/9 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, Apr 15, 2025
  53. 9/9 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, Apr 15, 2025
  54. Elijah NewrenApr 16, 2025
  55. Taylor BlauApr 16, 2025
  56. Elijah NewrenMay 13, 2025
  57. 0/9 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, May 28, 2025
  58. 1/9 pack-objects: use standard option incompatibility functionsTaylor Blau, May 28, 2025
  59. 2/9 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, May 28, 2025
  60. 3/9 pack-objects: factor out handling '--stdin-packs'Taylor Blau, May 28, 2025
  61. 4/9 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, May 28, 2025
  62. 5/9 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, May 28, 2025
  63. 6/9 pack-objects: fix typo in 'show_object_pack_hint()'Taylor Blau, May 28, 2025
  64. 7/9 pack-objects: swap 'show_{object,commit}_pack_hint'Taylor Blau, May 28, 2025
  65. 8/9 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, May 28, 2025
  66. 9/9 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, May 28, 2025
  67. Carlo Marcelo Arenas BelónJun 19, 2025
  68. fixup! repack: exclude cruft pack(s) from the MIDX where possibleCarlo Marcelo Arenas Belón, Jun 19, 2025
  69. Junio C HamanoJun 19, 2025
  70. Taylor BlauJun 19, 2025
  71. Taylor BlauMay 29, 2025
  72. Elijah NewrenMay 29, 2025
  73. 0/9 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, Jun 19, 2025
  74. 1/9 pack-objects: use standard option incompatibility functionsTaylor Blau, Jun 19, 2025
  75. 2/9 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, Jun 19, 2025
  76. 3/9 pack-objects: factor out handling '--stdin-packs'Taylor Blau, Jun 19, 2025
  77. 4/9 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, Jun 19, 2025
  78. 5/9 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, Jun 19, 2025
  79. 6/9 pack-objects: fix typo in 'show_object_pack_hint()'Taylor Blau, Jun 19, 2025
  80. 7/9 pack-objects: swap 'show_{object,commit}_pack_hint'Taylor Blau, Jun 19, 2025
  81. 8/9 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, Jun 19, 2025
  82. Junio C HamanoJun 20, 2025
  83. 9/9 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, Jun 19, 2025
  84. Jeff KingJun 21, 2025
  85. Taylor BlauJun 23, 2025
  86. Jeff KingJun 24, 2025
  87. Taylor BlauJun 24, 2025
  88. 0/9 repack: avoid MIDX'ing cruft pack(s) where possibleTaylor Blau, Jun 23, 2025
  89. 1/9 pack-objects: use standard option incompatibility functionsTaylor Blau, Jun 23, 2025
  90. Junio C HamanoJun 24, 2025
  91. Taylor BlauJun 24, 2025
  92. 2/9 pack-objects: limit scope in 'add_object_entry_from_pack()'Taylor Blau, Jun 23, 2025
  93. Junio C HamanoJun 23, 2025
  94. 3/9 pack-objects: factor out handling '--stdin-packs'Taylor Blau, Jun 23, 2025
  95. 4/9 pack-objects: declare 'rev_info' for '--stdin-packs' earlierTaylor Blau, Jun 23, 2025
  96. Junio C HamanoJun 23, 2025
  97. 5/9 pack-objects: perform name-hash traversal for unpacked objectsTaylor Blau, Jun 23, 2025
  98. Junio C HamanoJun 23, 2025
  99. Taylor BlauJun 24, 2025
  100. 6/9 pack-objects: fix typo in 'show_object_pack_hint()'Taylor Blau, Jun 23, 2025
  101. 7/9 pack-objects: swap 'show_{object,commit}_pack_hint'Taylor Blau, Jun 23, 2025
  102. 8/9 pack-objects: introduce '--stdin-packs=follow'Taylor Blau, Jun 23, 2025
  103. Junio C HamanoJun 23, 2025
  104. Taylor BlauJun 24, 2025
  105. 9/9 repack: exclude cruft pack(s) from the MIDX where possibleTaylor Blau, Jun 23, 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.