Skip to content

Commit b34ce7e

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aef8602 commit b34ce7e

File tree

3 files changed

+0
-24
lines changed

3 files changed

+0
-24
lines changed

reftable/iter.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,6 @@ static int filtering_ref_iterator_next(void *iter_arg,
4242
break;
4343
}
4444

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-
6545
if (ref->value_type == REFTABLE_REF_VAL2 &&
6646
(!memcmp(fri->oid.buf, ref->value.val2.target_value,
6747
fri->oid.len) ||

reftable/iter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ license that can be found in the LICENSE file or at
1818

1919
/* iterator that produces only ref records that point to `oid` */
2020
struct filtering_ref_iterator {
21-
int double_check;
22-
struct reftable_table tab;
2321
struct strbuf oid;
2422
struct reftable_iterator it;
2523
};

reftable/reader.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ static int reftable_reader_refs_for_unindexed(struct reftable_reader *r,
735735
*filter = empty;
736736

737737
strbuf_add(&filter->oid, oid, oid_len);
738-
reftable_table_from_reader(&filter->tab, r);
739-
filter->double_check = 0;
740738
iterator_from_table_iter(&filter->it, ti);
741739

742740
iterator_from_filtering_ref_iterator(it, filter);

0 commit comments

Comments
 (0)