0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-04 20:35:14 +02:00
Harsh Mahajan 792fa5eeba
feat(api): add q parameter to list branches API for server-side filtering (#37982)
The GET /repos/{owner}/{repo}/branches endpoint currently has no way to
filter branches by name server-side, forcing API consumers to paginate
through all branches and filter client-side.

The UI already supports branch search (added in
[#27055](https://github.com/go-gitea/gitea/pull/27055)). The underlying
DB layer has a Keyword field on FindBranchOptions in
models/git/branch_list.go that does a LIKE %keyword% SQL filter, it just
wasn't wired up to the API handler.

This PR exposes a ?q= query parameter on the endpoint that maps to
FindBranchOptions.Keyword.

Example:

```GET /repos/owner/repo/branches?q=feature ```
Closes #37981

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-06-03 16:21:48 -07:00
..