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
- Issue: gitlab#600332 (closed)
- Original implementation MR: gitlab!228758 (closed)
Screenshots or screen recordings
Not applicable (backend/proto change only).
How to set up and validate locally
- Check out this branch
- Run the tests:
go test ./internal/gitaly/service/ref/... -run TestFindLocalBranches -count=1 - 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.