Repository navigation
web: search repository branches and add GitHub-style branch tabs - #8590
Merged
Merged
Conversation
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
branch-search-react-flamego
branch
from
November 16, 2026 03:43
32d8b74 to
11cc1b5
Compare
unknwon
force-pushed
the
branch-search-react-flamego
branch
from
November 16, 2026 03:51
11cc1b5 to
f81709a
Compare
2 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the pull request
Adds GitHub-style tabs and search to the repository branches page. The page now has five views, each with its own URL: Overview (
/{owner}/{repo}/branches), Yours (/branches/yours), Active (/branches/active), Stale (/branches/stale) and All (/branches/all). A "Search branches…" field narrows any view by branch name, and the URL keeps the search as?query=, so links are shareable and Back works.GET /api/web/{owner}/{repo}/branchesreads every branch with a singlegit for-each-ref refs/heads --sort=-committerdate, which returns the name, commit, committer date, name and email, newest first. Before, it ran onegit cat-fileper branch. The new helper isgit.Repository.BranchesByCommitterDate.view=overview|yours|active|stale|all(defaultoverview, anything else is 400),query=andpage=.querymatches branch names by case-insensitive substring.pageandhasNext. The UI shows Previous and Next.{ defaultBranch, view, sections: [{ kind, branches, hasMore }], branches, page, hasNext, viewerCanWrite, allowsPulls, viewerCanChangeDefault }.sectionsis only filled for the overview andbranchesonly for the other views.view=yoursrequest returns an empty list (200).No branches match "…".smthe search field moves under the tabs, and the tab row scrolls sideways on its own, with the current tab scrolled into view. The page stays 375px wide.aria-current="page"now. Before, the Overview link was also marked on/branches/all, because the router matched it as a parent path.web/DESIGN.mddescribes the scrolling view switcher and the search-as-you-type field.Behavior changes
Screenshots
Overview as alice, with Your branches
Yours as alice: matches her primary and secondary activated emails, not an unverified one
Yours as bob
Active
Stale
All, page 2
Searching "feat" from the overview moves to All
A search with no matches
Signed out: no Yours tab or Your branches group
Active in dark mode
Checklist
Test plan
go test ./internal/git/ ./cmd/gogs/internal/web/ ./internal/route/...passes.TestRepository_BranchesByCommitterDatecovers the order, the committer fields, a time zone offset andfeature/search, a branch with a slash.TestBranchesFilter_SelectBranchescovers mixed-case search, the 30 and 90 day boundaries, Yours with another user's email, signed out, and 20 versus 21 branches.go vet ./cmd/... ./internal/...andgolangci-lint run ./...report 0 issues. Inweb/,pnpm run build,pnpm exec tsc -bandpnpm run lintpass.-tags prodbuild with SQLite. Pushed 25 branches toalice/alphawith committer dates from 1 to 500 days ago and various committers. Gave alice a secondary activated email and an unverified one, and committed branches with each, and with bob's email.view=allreturns 20 withhasNext: true, and page 2 returns the last 6 withhasNext: false.query=FEATmatchesfeature/…andFEATURE/….view=bogusreturns 400. Signed out,view=yoursreturns an empty list./branches/all?query=feawith the field still focused. Typing "t" replaced it with?query=feat, and Back returned to the overview with an empty field. In Active, "nothing-here" showed the empty state, and Back cleared it.?page=2, and Back returned to page 1.document.documentElement.scrollWidthis 375 on the overview, Yours and a search. The tab row scrolls on its own, and on All and Stale the current tab starts in view. Checked dark mode at 1280.