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

Re: [PATCH v2 0/6] global: drop `the_index` variable

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2024, 19:36 UTC
Message-ID
<xmqq34ritqdb.fsf@gitster.g>
In-Reply-To
<cover.1713442061.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 26 quoted lines
> this is the second version of my patch series that aims to drop
> `the_index`.
>
> Changes compared to v1:
>
>   - This version goes a bit further now and completely drops the
>     static `the_index` variable, as well. The repository's index gets
>     allocated dynamically now, like all the other sub-structures like
>     the ODB.
>
>   - This also allows this series to remove `initialize_the_repository()`
>     now. Instead, callers call `initialize_repository()` now.
>
> There is still quite an ugly hack in `initialize_repository()` which
> requires us to treat `the_repository` specially. This is because
> `the_hash_algo` maps to `the_repository->hash_algo`, and we rely on it
> being initialized to SHA1. So we need call `repo_set_hash_algo()` on
> `the_repository`. On the other hand, we cannot set the hash algo on
> repos which are not `the_repository`, because that breaks stuff, as
> well.
>
> I'm currently prepping another patch series that builds on top of this
> series and cleans up this mess. It surfaces several bugs that got masked
> by our setup, like for example `git rev-parse --short=` not working
> correctly with SHA256 because we always truncate to the maximum length
> of SHA1.

I'll take a look, and may even comment on them later, but let me otherwise place this series on the back burner, not because I am in love with the_index (I am not) and not because I think the "index" member in the repository struct is a mistake (I suspect it is, but I am not convinced either way), but because I'd prefer to see our tree to be quiescent when we apply a tree-wide patch like [2/6], but we'll be in -rc period soonish, during which time we'd want to be able to concentrate on fixing regressions without having to worry about being able to reapply such tree-wide changes to keep 'next' and 'seen' building.

Thanks.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 25 of 26 in “global: drop external `the_index` variable”
  1. 0/5 global: drop external `the_index` variablePatrick Steinhardt, Apr 15, 2024
  2. 1/5 t/helper: stop using `the_index`Patrick Steinhardt, Apr 15, 2024
  3. Karthik NayakApr 17, 2024
  4. 2/5 builtin: stop using `the_index`Patrick Steinhardt, Apr 15, 2024
  5. Karthik NayakApr 17, 2024
  6. Patrick SteinhardtApr 18, 2024
  7. 3/5 repository: initialize index in `repo_init()`Patrick Steinhardt, Apr 15, 2024
  8. Karthik NayakApr 17, 2024
  9. Patrick SteinhardtApr 18, 2024
  10. 4/5 builtin/clone: stop using `the_index`Patrick Steinhardt, Apr 15, 2024
  11. 5/5 repository: drop global `the_index` variablePatrick Steinhardt, Apr 15, 2024
  12. Phillip WoodApr 15, 2024
  13. Patrick SteinhardtApr 15, 2024
  14. Junio C HamanoApr 15, 2024
  15. Patrick SteinhardtApr 16, 2024
  16. Karthik NayakApr 17, 2024
  17. Patrick SteinhardtApr 18, 2024
  18. 0/6 global: drop `the_index` variablePatrick Steinhardt, Apr 18, 2024
  19. 1/6 t/helper: stop using `the_index`Patrick Steinhardt, Apr 18, 2024
  20. 2/6 builtin: stop using `the_index`Patrick Steinhardt, Apr 18, 2024
  21. 3/6 repository: initialize index in `repo_init()`Patrick Steinhardt, Apr 18, 2024
  22. 4/6 builtin/clone: stop using `the_index`Patrick Steinhardt, Apr 18, 2024
  23. 5/6 repository: drop `the_index` variablePatrick Steinhardt, Apr 18, 2024
  24. 6/6 repository: drop `initialize_the_repository()`Patrick Steinhardt, Apr 18, 2024
  25. Junio C HamanoApr 18, 2024
  26. Patrick SteinhardtApr 19, 2024

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.