Merge branch 'ps/reftable-exclude'

The reftable backend learned to more efficiently handle exclude
patterns while enumerating the refs.

* ps/reftable-exclude:
  refs/reftable: wire up support for exclude patterns
  reftable/reader: make table iterator reseekable
  t/unit-tests: introduce reftable library
  Makefile: stop listing test library objects twice
  builtin/receive-pack: fix exclude patterns when announcing refs
  refs: properly apply exclude patterns to namespaced refs
This commit is contained in:
Junio C Hamano
2024-09-25 10:37:11 -07:00
16 changed files with 594 additions and 201 deletions

View File

@ -340,12 +340,26 @@ static void show_one_alternate_ref(const struct object_id *oid,
static void write_head_info(void)
{
static struct oidset seen = OIDSET_INIT;
struct strvec excludes_vector = STRVEC_INIT;
const char **exclude_patterns;
/*
* We need access to the reference names both with and without their
* namespace and thus cannot use `refs_for_each_namespaced_ref()`. We
* thus have to adapt exclude patterns to carry the namespace prefix
* ourselves.
*/
exclude_patterns = get_namespaced_exclude_patterns(
hidden_refs_to_excludes(&hidden_refs),
get_git_namespace(), &excludes_vector);
refs_for_each_fullref_in(get_main_ref_store(the_repository), "",
hidden_refs_to_excludes(&hidden_refs),
show_ref_cb, &seen);
exclude_patterns, show_ref_cb, &seen);
for_each_alternate_ref(show_one_alternate_ref, &seen);
oidset_clear(&seen);
strvec_clear(&excludes_vector);
if (!sent_capabilities)
show_ref("capabilities^{}", null_oid());