Re: [PATCH v2 3/4] odb: drop `loaded_alternates` field
Karthik Nayak <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <CAOLa=ZR1CHHXYjfuJBC0wGqzCYkKUMr2oBbmeUnzz_vCNkegBw@mail.gmail.com> |
Patrick Steinhardt <[email protected]> writes: > The `struct object_database::loaded_alternates` field tells us whether > or not alternates have been loaded already. This field was useful before > the preceding commit as we were indeed lazy-loading alternates. But now > that we started to eagerly load them we can assume them to be loaded > after `odb_new()`, and hence the field does not serve any purpose > anymore. > > Remove it. > > Signed-off-by: Patrick Steinhardt <[email protected]> > --- > odb.c | 9 +-------- > odb.h | 2 -- > 2 files changed, 1 insertion(+), 10 deletions(-) > > diff --git a/odb.c b/odb.c > index 2ae8228dd2..2eb37a2f44 100644 > --- a/odb.c > +++ b/odb.c > @@ -230,8 +230,7 @@ void odb_add_to_alternates_file(struct object_database *odb, > int ret = odb_source_write_alternate(odb->sources, dir); > if (ret < 0) > die(NULL); > - if (odb->loaded_alternates) > - odb_add_alternate_recursively(odb, dir, 0); > + odb_add_alternate_recursively(odb, dir, 0); > } > > struct odb_source *odb_add_to_alternates_memory(struct object_database *odb, > @@ -495,16 +494,11 @@ static void odb_prepare_alternates(struct object_database *odb) > { > struct strvec sources = STRVEC_INIT; > > - if (odb->loaded_alternates) > - return; > - > parse_alternates(odb->alternate_db, PATH_SEP, NULL, &sources); > odb_source_read_alternates(odb->sources, &sources); > for (size_t i = 0; i < sources.nr; i++) > odb_add_alternate_recursively(odb, sources.v[i], 0); > > - odb->loaded_alternates = 1; > - > strvec_clear(&sources); > } > > @@ -1132,7 +1126,6 @@ void odb_prepare(struct object_database *o, enum odb_prepare_flags flags) > * the lifetime of the process. > */ > if (flags & ODB_PREPARE_FLUSH_CACHES) { > - o->loaded_alternates = 0; > odb_prepare_alternates(o); > o->object_count_valid = 0; > } I was looking at this exact field in the previous commit and wondering if it needs to be removed, spot on. Makes sense. > diff --git a/odb.h b/odb.h > index fbafee174b..aefb34213f 100644 > --- a/odb.h > +++ b/odb.h > @@ -69,8 +69,6 @@ struct object_database { > */ > int source_paths_icase; > > - int loaded_alternates; > - > /* > * A list of alternate object directories loaded from the environment; > * this should not generally need to be accessed directly, but will > > -- > 2.55.0.679.g6767b8d81c.dirty The patch looks good.
signature.asc
(application/pgp-signature, 690 B)
-----BEGIN PGP SIGNATURE----- iQHKBAEBCgA0FiEEV85Mf2N1cQ/LZcYGPtWfJI5GjH8FAmp9t9UWHGthcnRoaWsu MTg4QGdtYWlsLmNvbQAKCRA+1Z8kjkaMf0U3C/4hk+D3tah6Quqtzh1v4HLoHxiq kgRaypeJ+24otZOaz7xoPekN7og/BWUxEPRzIXLoZTcTwE88MWvuJz5UeCKAvIaW HH2c9KFIH1jYYU49HSJ29zZblLgSq254/yBb6+1JehXdafnAsSVkp69cWBRwggKn IDeeOwGofhlaX/WxqPBm98Cr7FSY6EoJf7Jf5+QDiqHoizmQJ88p2UIVRi8Vczf4 ObwSCKx9cUqn8byQYC3z4RGZW57udUwyrNHHbJFs7GZ654HR29j2/2a3usGnoula ByhhlZgq68xcE9txNjw0eKisMqvfm2UxRsjkhWALpda6oOGKgWOgcyUfnzFNnFt8 yLWSz8Upe9W/8O29Y0CoVMNe/8pjYzPI9jMtTqdocRwdw8br0Ic99fJnaWaVz8cU 9AXLeMgFnnVzkThoM0rQLTkzQmYDaZaMn4o1QuapSYwP6F0fCRXtQZ6lGq47tRyT dNOV1Z6oRK+MIcSm+C1TDAoPKFtLF9xRtTSLgtw= =a5MH -----END PGP SIGNATURE-----