reftable/iter: drop double-checking logic

The filtering ref iterator can be used to only yield refs which are not in a specific skip list. This iterator has an option to double-check the results it returns, which causes us to seek the reference we are about to yield via a separate table such that we detect whether the reference that the first iterator has yielded actually exists. The value of this is somewhat dubious, and I cannot think of any usecase where this functionality should be required. Furthermore, this option is never set in our codebase, which means that it is essentially untested. And last but not least, the `struct reftable_table` that is used to implement it is about to go away. So while we could refactor the code to not use a `reftable_table`, it very much feels like a wasted effort. Let's just drop this code. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 22, 2024 at 08:34 UTC b34ce7e911e315390b64f565accc6ca79e85443a
3 files changed -24
reftable/iter.c
-20
@@ -42,26 +42,6 @@ static int filtering_ref_iterator_next(void *iter_arg,
42 break;
43 }
44
45 - if (fri->double_check) {
46 - struct reftable_iterator it = { NULL };
47 -
48 - reftable_table_init_ref_iter(&fri->tab, &it);
49 -
50 - err = reftable_iterator_seek_ref(&it, ref->refname);
51 - if (err == 0)
52 - err = reftable_iterator_next_ref(&it, ref);
53 -
54 - reftable_iterator_destroy(&it);
55 -
56 - if (err < 0) {
57 - break;
58 - }
59 -
60 - if (err > 0) {
61 - continue;
62 - }
63 - }
64 -
45 if (ref->value_type == REFTABLE_REF_VAL2 &&
46 (!memcmp(fri->oid.buf, ref->value.val2.target_value,
47 fri->oid.len) ||
reftable/iter.h
-2
@@ -18,8 +18,6 @@ https://developers.google.com/open-source/licenses/bsd
18
19 /* iterator that produces only ref records that point to `oid` */
20 struct filtering_ref_iterator {
21 - int double_check;
22 - struct reftable_table tab;
21 struct strbuf oid;
22 struct reftable_iterator it;
23 };
reftable/reader.c
-2
@@ -735,8 +735,6 @@ static int reftable_reader_refs_for_unindexed(struct reftable_reader *r,
735 *filter = empty;
736
737 strbuf_add(&filter->oid, oid, oid_len);
738 - reftable_table_from_reader(&filter->tab, r);
739 - filter->double_check = 0;
738 iterator_from_table_iter(&filter->it, ti);
739
740 iterator_from_filtering_ref_iterator(it, filter);