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

Re: Discuss GSOC: Refactoring in order to reduce Git’s global state

From
Ayush Chandekar <ayu.chandekar@gmail.com>
Date
Mar 7, 2025, 15:44 UTC
Message-ID
<CAE7as+a+z9EgBnws-a4250TN_hDgWgapefxVAQHvpmUEfqKeTw@mail.gmail.com>
In-Reply-To
<Z8qpxj2i3vFjJe4l@pks.im>
Thanks for taking the time to respond!
Show 9 quoted lines
> Yeah, things depending on `startup_info` are definitely a more involved
> thing to address, and I wouldn't necessarily recommend it for the
> initial batch of refactorings. I'd recommend to rather focus on some of
> the global variables we have in "environment.c" that store configuration
> values, which are generally a bit easier to tackle.
>
> Also note that `local_repo_env[]` is nothing that we need to adapt. It
> only stores a couple of environment variable names and does not have any
> state, so it's perfectly fine to keep that variable.
Okay, got it.
Show 18 quoted lines
> It would be a bit more involved than a typical microproject, but I don't
> think it's particularly bad. It would involve a couple of steps:
>
>   - Investigate all users of the `git_attributes_file` global variable
>     and how they interact with the variable.
>
>   - Adapt `git_attr_global_file()` so that it knows to not only handle
>     the fallback value of `xdg_config_home("attributes")`, but also
>     knows to first read the value from the config.
>
>   - Adapt `git_attr_global_file()` so that it accepts a repository as
>     parameter so that it doesn't need to depend on `the_repository`.
>     This will also require you to adapt all callers.
>
> You _can_ use this as a microproject, but as said it's a bit more
> involved than what we'd expect. Which isn't necessarily bad if you
> manage to pull it off, but might make for a bit of a steep learning
> curve.

I already submitted a patch quite a while ago: [1]. Thank you for clarifying how to approach this! It looks interesting to me, and I'd love to give it a try. I'll study more about it and hopefully submit a patch soon :)

Thanks, Ayush

[1]: https://lore.kernel.org/git/20250202120926.322417-1-ayu.chandekar@gmail.com/
Previous: Patrick SteinhardtNext: Ayush Chandekar
Message 4 of 6 in “Discuss GSOC: Refactoring in order to reduce Git’s global state”
  1. Ayush ChandekarMar 5, 2025
  2. shejialuoMar 5, 2025
  3. Patrick SteinhardtMar 7, 2025
  4. Ayush ChandekarMar 7, 2025
  5. Ayush ChandekarMar 8, 2025
  6. Ayush ChandekarMar 7, 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.