Skip to content

web: migrate the repository commit history pages to React - #8533

Merged
unknwon merged 3 commits into
mainfrom
commits-react-flamego
Nov 16, 2026
Merged

unknwon merged 3 commits into
mainfrom
commits-react-flamego

Conversation

@unknwon

@unknwon unknwon commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Describe the pull request

Migrates the repository commit history to React: the history of a ref (/{owner}/{repo}/commits/{ref}), of a file or directory (/commits/{ref}/{path}), and the search of commit messages (/commits/{ref}/search?q=). They are backed by GET /api/web/{owner}/{repo}/commits/{ref}/{path}.

  • Access is the same as legacy. Readers of a non-empty repository see the history, and everyone else gets 404.
  • Refs: the ref is the shortest leading part of the path that names a branch or a tag, like legacy. A commit SHA also works, and so does a short one (7 to 40 characters), so the "View history" link of the commit page works for abbreviated SHAs. No ref means the default branch.
  • List: commits are grouped by day. Each row shows the subject with links to the issues it mentions, the author's avatar and profile link, and when it was committed. On the right are the short SHA linking to the commit page, a copy button, and a "Browse files" link at that commit. Merge commits are muted, like legacy.
  • Ref picker: RefPicker is a new popover with a filter and tabs for branches and tags. Switching keeps the path or the search. The code page can reuse it.
  • File history shows a "History for" breadcrumb that links each directory to the file browser.
  • Paging uses Newer and Older, with the page in ?page=. Search lists every match, like legacy.
  • Removed: the legacy RefCommits, Commits, SearchCommits and FileHistory handlers and repo/commits.tmpl. The commit-history branches of commits_table.tmpl and branch_dropdown.tmpl are gone too. The compare and pull request pages still use both templates.
  • Sentence-cased "Commit history". Added repo.tag, commits.history_for, commits.committed and commits.no_commits.

Behavior changes from legacy

  • Short SHAs work as refs. Legacy accepted only full ones.
  • pageSize is capped at 100.
  • Commits are grouped by day instead of shown in a table with a date column.

Screenshots

Commit history of a branch

Commit history of a branch

Branch and tag picker

Branch and tag picker

File history, dark

File history, dark

Searching commit messages

Searching commit messages

Older page

Older page

File history, 375px
File history, 375px
Picker, 375px
Picker, 375px

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code and provided the test plan below.
  • I have added an entry to CHANGELOG.

Test plan

  1. go test ./cmd/gogs/internal/web/ ./internal/route/... passes, and TestRequireViewAccess covers the new endpoint. moon run gogs:lint and moon run web:lint report 0 issues.
  2. Ran a -tags prod build with SQLite. Seed: alice owns the public widgets, the empty empty and the private secret. carol has no access.
  3. API: the default branch, master?page=2&pageSize=3, feature/login (a branch with a slash), a tag, a short SHA with README.md, and master/docs/drafts return the right commits. master/search?q=readme returns the two matching commits. A missing ref gets 404. Signed-out visitors and carol get 404 on secret, and alice gets 404 on empty. A message with #1 and <img onerror> comes back with an issue link and the HTML escaped.
  4. Browser, at 1280, dark and 375: filtered the picker to feature/login and switched to it. Switched to a tag while searching and kept the search. Opened the history of docs/drafts/notes.txt and checked the breadcrumb links. Searched for "readme". With 36 commits, went to the older page and back. No sideways scroll at 375.
  5. Browser, again on alice/alpha rebased on main, with 45 commits, a merge of feature/search, tags v1.0.0 and v1.1.0, and issue Register/delete users #1:
    • The history of main shows 30 commits grouped by day, and Older shows the other 15 at ?page=2, matching git rev-list --count. Every fixes #1 links to the issue, and the merge commit is muted.
    • The picker lists both branches, its Tags tab lists both tags, and picking v1.0.0 opens its history.
    • Searching "refactor" lists 12 commits and src/mod3.go lists 8, the same as git log. The file history breadcrumb links alpha and src. A 7-character SHA works as the ref.
    • With the repository private, bob and signed-out visitors get 404 from the page and the endpoint, and alice gets 200. Nothing scrolls sideways at 375 in light or dark.

unknwon added a commit that referenced this pull request Nov 13, 2026
@unknwon
unknwon added this pull request to stack #8457 November 13, 2026 13:51
@unknwon
unknwon force-pushed the commits-react-flamego branch from 3c42cd8 to 61cf579 Compare November 13, 2026 15:59
@unknwon
unknwon force-pushed the commits-react-flamego branch 2 times, most recently from 64d3f74 to 7932f5e Compare November 14, 2026 07:09
@unknwon
unknwon force-pushed the commits-react-flamego branch 3 times, most recently from abfb9b4 to dae0dbe Compare November 14, 2026 16:03
@unknwon
unknwon force-pushed the commits-react-flamego branch 6 times, most recently from e06a86b to d5e08b3 Compare November 14, 2026 19:34
@unknwon
unknwon force-pushed the commits-react-flamego branch 2 times, most recently from 4448ad9 to 7848a42 Compare November 14, 2026 20:21
@unknwon
unknwon force-pushed the commits-react-flamego branch 3 times, most recently from e3932b5 to f690a14 Compare November 14, 2026 22:10
@unknwon
unknwon force-pushed the commits-react-flamego branch 4 times, most recently from e2fd21a to f3a6d38 Compare November 15, 2026 00:23
@unknwon
unknwon force-pushed the commits-react-flamego branch from 56a68d0 to a91e6c9 Compare November 15, 2026 02:17
@unknwon
unknwon force-pushed the commits-react-flamego branch 7 times, most recently from 94fcf64 to cafe8b7 Compare November 15, 2026 05:34
@unknwon
unknwon force-pushed the commits-react-flamego branch 4 times, most recently from bba2b5b to fbfd843 Compare November 15, 2026 22:18
@unknwon
unknwon force-pushed the commits-react-flamego branch from fbfd843 to 80c7670 Compare November 15, 2026 22:45
@unknwon
unknwon force-pushed the commits-react-flamego branch 3 times, most recently from f682a2a to 1280650 Compare November 16, 2026 02:24
Base automatically changed from editor-react-flamego to main November 16, 2026 02:56
@unknwon
unknwon marked this pull request as ready for review November 16, 2026 02:57
@unknwon
unknwon force-pushed the commits-react-flamego branch from 1280650 to e16551a Compare November 16, 2026 03:07
The commit history of a branch, a tag or a commit, the history of a file or
a directory, and the search of commit messages are now a React page backed
by /api/web/{owner}/{repo}/commits, with a picker for branches and tags.
@unknwon
unknwon force-pushed the commits-react-flamego branch from e16551a to b470e0a Compare November 16, 2026 03:40
@unknwon
unknwon merged commit 37b859d into main Nov 16, 2026
12 checks passed
@unknwon
unknwon deleted the commits-react-flamego branch November 16, 2026 03:48
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