Re: [PATCH 5/5] treewide: always have a valid "index_state.repo" member
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jan 10, 2023, 12:24 UTC
- Message-ID
- <230110.86o7r6zibu.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <patch-5.5-b3b0e592101-20230110T060340Z-avarab@gmail.com>
On Tue, Jan 10 2023, Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> diff --git a/repository.c b/repository.c > index 3427085fd6d..fdebc8c597c 100644 > --- a/repository.c > +++ b/repository.c > @@ -28,6 +28,8 @@ void initialize_the_repository(void) > the_repo.remote_state = remote_state_new(); > the_repo.parsed_objects = parsed_object_pool_new(); > > + the_index.repo = the_repository; > + > repo_set_hash_algo(&the_repo, GIT_HASH_SHA1); > }
It's slightly odd to have initialize_the_repository() initialize this other variable, I did consider adding a initialize_the_variables(), and have that call an initialize_the_repository() and an initialize_the_index(), but deemed it not worth it for now. Perhaps something to revisit once we're initializing more variables here.
Arguably such a split doesn't even conceptually make sense, as we're now declaring that "the_repository" isn't fully initalized unless the corresponding "the_index.repo" is also set, i.e. this really is part of "the_repository" initialization.