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

Re: [GSoC PROPOSAL v1] Refactoring in order to reduce Git’s global state

From
Patrick Steinhardt <ps@pks.im>
Date
Apr 3, 2025, 09:59 UTC
Message-ID
<Z-5b6INZXiXbEuU2@pks.im>
In-Reply-To
<1077615a-1c31-416d-a754-58b36d404289@gmail.com>

On Wed, Apr 02, 2025 at 11:44:12PM +0530, Arnav Bhate wrote: [snip]

> ## Proposed Plan
> 
> - Identifying all occurences of `the_repository` and updating them to
>   use a `struct repository` passed to the function.

I think that might be overly ambituous :) After all we're talking about ~3500 occurrences, and it won't be feasible to replace them all in the couple of months. This is rather a multi-year project, and one that has already been going on for quite a while.

> - Identifying global variables that should be moved and identifying
>   suitable locations, some could be moved directly into
>   `struct repository`, some in its sub-structs that already exist and
>   some in newly created sub-structs.

Likewise, I would recommend to properly scope _which_ variables you want to replace. There's a ton of global state, so you should try to limit the project to a reasonable workload.

Show 33 quoted lines
> - Identifying and updating occurences of these variables to reference
>   their new locations.
> 
> It makes sense that all the variables need not be in the same struct, as
> separation would keep the codebase organised, and thus easier to
> maintain. It would also make it easier to introduce these changes
> systematically, as a group of related variables, combined together in a
> struct, could be introduced in a single patch series.
> 
> ### Timeline
> 
> #### Pre-GSoC (Until May 8)
> 
> - Explore the codebase, identifying global variables and how they are
>   used.
> 
> - Start to identify suitable locations for global variables.
> 
> #### Community Bonding Period (May 8 - June 1)
> 
> - Interact with mentor, discussing best ways to refactor various
>   variables and make a plan based on that.
> 
> - If time is left, start coding early, as my summer break will have
>   started.
> 
> #### Coding Period (June 2 - August 25)
> 
> - Modify functions to add an `struct repository` argument where they
>   depend on `the_repository` and replace all occurences of it.
> 
> - Move global variables to their new locations in various structs,
>   and refactor functions that depend on them to use their new locations.

In large-scale projects like these it typically makes sense to work in batches. Instead of having three separate phases to "define the problem", "develop the solution" and "deploy the improvement" I would strongly encourage you to define and tie together smaller batches of work.

Thanks!
Patrick
Previous: Arnav BhateNext: Arnav Bhate
Message 2 of 5 in “[GSoC PROPOSAL v1] Refactoring in order to reduce Git’s global state”
  1. Arnav BhateApr 2, 2025
  2. Patrick SteinhardtApr 3, 2025
  3. Arnav BhateApr 3, 2025
  4. Patrick SteinhardtApr 4, 2025
  5. [GSoC PROPOSAL v2] Refactoring in order to reduce Git’s global stateArnav Bhate, Apr 5, 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.