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

Re: [PATCH 2/3] midx: close multi-pack-index on repack

From
Derrick Stolee <stolee@gmail.com>
Date
Oct 9, 2018, 14:11 UTC
Message-ID
<8b5dbe3d-b382-bf48-b524-d9e8a074ac4d@gmail.com>
In-Reply-To
<xmqq4ldvqyci.fsf@gitster-ct.c.googlers.com>
On 10/9/2018 5:10 AM, Junio C Hamano wrote:
Show 18 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> diff --git a/builtin/repack.c b/builtin/repack.c
>> index c6a7943d5c..7925bb976e 100644
>> --- a/builtin/repack.c
>> +++ b/builtin/repack.c
>> @@ -432,6 +432,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
>>   
>>   			if (!midx_cleared) {
>>   				/* if we move a packfile, it will invalidated the midx */
>> +				if (the_repository->objects) {
>> +					close_midx(the_repository->objects->multi_pack_index);
>> +					the_repository->objects->multi_pack_index = NULL;
>> +				}
>>   				clear_midx_file(get_object_directory());
>>   				midx_cleared = 1;
> It somehow looks like a bit of layering violation, doesn't it?  When
> we are clearing a midx file, don't we always want to do this as well?

You're right. It did feel a bit wrong. In v2, I'll replace this commit with a refactor of clear_midx_file() to do that. One tricky part is that we need to clear the file even if the in-memory struct hasn't been initialized, but I think passing a repository will suffice for that.

CC Stefan: Is there a plan to make get_object_directory() take a repository parameter?

Thanks,
-Stolee
Previous: Junio C HamanoNext: Stefan Beller
Message 6 of 14 in “Add GIT_TEST_MULTI_PACK_INDEX environment variable”
  1. 0/3 Add GIT_TEST_MULTI_PACK_INDEX environment variableDerrick Stolee via GitGitGadget, Oct 8, 2018
  2. 1/3 midx: fix broken free() in close_midx()Derrick Stolee via GitGitGadget, Oct 8, 2018
  3. Junio C HamanoOct 9, 2018
  4. 2/3 midx: close multi-pack-index on repackDerrick Stolee via GitGitGadget, Oct 8, 2018
  5. Junio C HamanoOct 9, 2018
  6. Derrick StoleeOct 9, 2018
  7. Stefan BellerOct 9, 2018
  8. 3/3 multi-pack-index: define GIT_TEST_MULTI_PACK_INDEXDerrick Stolee via GitGitGadget, Oct 8, 2018
  9. 0/3 Add GIT_TEST_MULTI_PACK_INDEX environment variableDerrick Stolee via GitGitGadget, Oct 12, 2018
  10. 1/3 midx: fix broken free() in close_midx()Derrick Stolee via GitGitGadget, Oct 12, 2018
  11. 3/3 multi-pack-index: define GIT_TEST_MULTI_PACK_INDEXDerrick Stolee via GitGitGadget, Oct 12, 2018
  12. 2/3 midx: close multi-pack-index on repackDerrick Stolee via GitGitGadget, Oct 12, 2018
  13. Derrick StoleeOct 12, 2018
  14. Junio C HamanoOct 22, 2018

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.