Skip to content

feat: add metadata for branches - #1168

Draft
Lueton wants to merge 1 commit into
sourcegraph:mainfrom
Lueton:feature/branch-metadata
Draft

Lueton wants to merge 1 commit into
sourcegraph:mainfrom
Lueton:feature/branch-metadata

Conversation

@Lueton

@Lueton Lueton commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

About this feature

Repository already supports arbitrary key-value metadata via Metadata, queryable with meta.<field>:. This PR adds the same concept at branch level. RepositoryBranch gets a Metadata map[string]string field and a new query operator branch.meta.<field>:<regex> matches only files belonging to a branch whose metadata satisfies the given regex. Population happens the same way repository metadata does today, via the .meta file passed to zoekt-git-index

Why we want this feature

Repository-level metadata works well when an attribute is constant across the whole repo, but many repos have several long-lived branches (release lines, LTS branches, version branches) where an attribute like "actively supported" or "end of life" differs per branch, not per repo. Also are some branches maintained by different teams which we would like to assign and filter for. Today there is no way to express that without tagging the whole repo. branch.meta. lets indexers attach that per-branch fact and lets searchers scope a query to only the branches that currently matter, e.g. branch.meta.supported:true

Why this is still a draft

Opening this early to get feedback on the approach before polishing it further:

  • The query operator name (branch.meta.) is up for discussion happy to hear alternatives if there's a preferred convention (zoekt has already meta which is for repos only).
  • Comments in the code are deliberately verbose in places to make the design decisions explicit and easy to challenge.

We'd love to hear your feedback and are happy to discuss any part of this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant