Re: [GSOC PATCH v6 0/3] environment: remove sparse-checkout related global variables
From: Ayush Chandekar <hidden>
Date: 2025-08-27 21:31:58
On Tue, Aug 26, 2025 at 5:50 PM Derrick Stolee [off-list ref] wrote:
On 8/10/25 11:36 AM, Ayush Chandekar wrote:quoted
Just an update, I'm still working on this patch series.Hi Ayush. Do you have an update on your progress? Perhaps there is something you're stuck on and could use some help?
Hi Derrick, thanks for checking in! I have made a few branches by trying out different ways: [1],[2] & [3] I am quite close to sending the patch series now.
A few weeks ago, I played around with the ideas around updating
the location of these globals into the repository struct and
made this critical observation:
It's "easy" to move the global into the_repository, but it
becomes harder (and changes behavior) if we start referring
to the data in each repository struct.
It may be good to separate the two things into different steps:
1. Move the globals into the repository struct, but only set
or read from the_repository->sparse_checkout[_cone].
2. Replace the use of the_repository and instead refer to a
specific repo. This may change behavior of the feature in
the presence of submodules with different config than the
root repo (tests before and after will be necessary).
We'll also need to update the_repository during the very
early config parsing but then update other repos during
repo initialization.
Does this make sense based on your progress in this space?Yes, I was able to do the first step, the second step means that I have to pass the repo struct to quite a few functions.
Thanks, -Stolee
Thanks! Ayush:) [1]: https://github.com/ayu-ch/git/commits/sparse-checkout-6 (Stored the variables in the 'struct repository' as int, and made a function to read their values from the config) [2]: https://github.com/ayu-ch/git/commits/sparse-checkout-7 (Christian suggested me that I can also store them as booleans so I tried it.) [3]: https://github.com/ayu-ch/git/commits/sparse-checkout-8 (Similar to [1] but set their value as -1 when uninitialized. Tests seem to fail though when I make this change.)