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

Re: [PATCH v2] object-file: reprepare alternates when necessary

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Mar 11, 2023, 03:09 UTC
Message-ID
<20230311030923.4171623-1-jonathantanmy@google.com>
In-Reply-To
<xmqqilf8yx3k.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > But I guess clearing a linked list and hashmap can be a bit cumbersome
> > in C, so maybe it would be reasonable to assume that this behavior
> > would not change.
> 
> I think the original reason why we did not clear was because we
> never knew (and we do not know) what is still in use.  

Ah, I meant that prepare_alt_odb() assumes that the data structures are as they were originally initialized. So I can think of at least 2 ways that we could implement prepare_alt_odb():

 (a) Repeatedly modify r->objects->odb_tail and repeatedly assign to
     kh_value(r->objects->odb_by_path, pos).
 (b) Call make_odb(), which returns a pointer that we assign to
     r->objects->odb, and call make_odb_hashmap(), which returns a
     pointer that we assign to r->objects->odb_by_path.

Remember that prepare_alt_odb() is meant to start from scratch, so it is reasonable to do either.

In Java, for example, it would be very reasonable to do (b). But this patch assumes that we have implemented it as (a). Indeed we have implemented it as (a) (although we have never documented it as such), and my quoted statement above is meant to say that it might be reasonable to keep assuming that it would be (a).

Previous: Junio C Hamano
Message 19 of 19 in “object-file: reprepare alternates when necessary”
  1. object-file: reprepare alternates when necessaryDerrick Stolee via GitGitGadget, Mar 6, 2023
  2. Junio C HamanoMar 6, 2023
  3. Taylor BlauMar 7, 2023
  4. Derrick StoleeMar 7, 2023
  5. Junio C HamanoMar 7, 2023
  6. Taylor BlauMar 8, 2023
  7. Derrick StoleeMar 8, 2023
  8. Ævar Arnfjörð BjarmasonMar 7, 2023
  9. Junio C HamanoMar 7, 2023
  10. Junio C HamanoMar 7, 2023
  11. Derrick StoleeMar 8, 2023
  12. object-file: reprepare alternates when necessaryDerrick Stolee via GitGitGadget, Mar 8, 2023
  13. Junio C HamanoMar 8, 2023
  14. Taylor BlauMar 8, 2023
  15. Jeff KingMar 9, 2023
  16. Eric WongMar 9, 2023
  17. Jonathan TanMar 10, 2023
  18. Junio C HamanoMar 11, 2023
  19. Jonathan TanMar 11, 2023

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.