Add exclude_patterns to FindLocalBranches RPC

What does this MR do and why?

Contributes to gitlab#600332 (closed)

Problem

GitLab Rails currently filters protected branches out of FindLocalBranches results on the client side. Because filtering happens after pagination, pages can come back short or report has_next_page: false while unprotected branches still exist further in the list.

Solution

Add a new exclude_patterns field to FindLocalBranchesRequest that maps to --exclude=<pattern> flags on git for-each-ref. This lets the caller exclude specific ref patterns (exact or glob) server-side, so Gitaly returns only the desired branches with correct pagination.

References

Screenshots or screen recordings

Not applicable (backend/proto change only).

How to set up and validate locally

  1. Check out this branch
  2. Run the tests:
    go test ./internal/gitaly/service/ref/... -run TestFindLocalBranches -count=1
  3. All 54 test cases should pass (27 per feature flag variant)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading