Forgejo and Gitea: the changed files of a pull request
Forgejo and Gitea list the files a pull request changes at GET /repos/OWNER/REPO/pulls/NUMBER/files, a page at a time, from the merge base to the pull request's own head (refs/pull/NUMBER/head). Neither refuses a large pull request: every file is listed, page by page. The answers below are what codeberg.org (Forgejo) and gitea.com (Gitea) said on October 25, 2026, with the servers' source behind them.
HTTP/1.1 404 Not Found
{"message":"The target couldn't be found.","url":"https://codeberg.org/api/swagger","errors":[]}
404
The target couldn't be found.(Forgejo),not found(Gitea): the repository has no pull request with that number, or the repository is missing or not visible to your token (see 404 "The target couldn't be found." and "not found").
Pages, and what a page holds
- 50 a page at most:
limitis capped at the server's maximum, 50 by default (MAX_RESPONSE_ITEMS); both servers answered 50 a page when asked for 100.X-Total-Countgives the number of files,X-HasMorewhether another page follows, andLinknames it. A page past the end answers 200 with an empty list. skip-to=FILEstarts the list at that file. Forgejo's count starts there too (on codeberg.org, a pull request of 52 files answered 42 from its eleventh file); in Gitea's source,X-Total-Countstays the whole pull request's.- No patch in the list: each file has
filename,status,additions,deletions,changesand the file's addresses (html_url,contents_url,raw_url), withprevious_filenamefor a rename. The diff of the whole pull request comes as text fromGET /repos/OWNER/REPO/pulls/NUMBER.diff. - How a page is made: in the servers' source, Gitea works out the diff of every file for each page and hands out one page of it, while Forgejo lists the files' names first and works out only that page's files. A very large pull request costs Gitea more on every page.
200, but changed_files does not match the list
- Open pull requests agree (codeberg.org:
changed_files52, and 52 files in the list). Merged ones can be far apart: two merged pull requests on codeberg.org saidchanged_files1237 and 5537, and their lists held 56 and 8 files. - Why, in Forgejo's source:
changed_filesis counted from the merge base it stored to the head branch as it is now, while the branch still exists; the list compares up to the pull request's own head. A head branch that moved on after the merge is counted with everything pushed to it since.
What to do
- Read every page: follow
LinkorX-HasMorewithlimit=50. - How many files: take
X-Total-Countof the list, notchanged_filesof a merged pull request. - Every line:
GET /repos/OWNER/REPO/pulls/NUMBER.diff, or locallygit fetch origin refs/pull/NUMBER/head, thengit diff origin/BASE...FETCH_HEAD.
Forgejo and Gitea pull requests in IntelliJ IDEA
Pull Request Inbox for Forgejo and Gitea, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, reads a pull request's changed files from this list, 50 a page, up to 1,000 files. Each file opens in the IDE's diff with the whole file read at the merge base and at the head commit. From version 1.0.20, when a pull request changes more than 1,000 files, the count of viewed files says that only the first files are listed and that git diff shows the rest; before, the list ended without saying so. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
Forgejo, Gitea and Codeberg are names of their respective owners; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Forgejo project, Codeberg e.V., the Gitea project or JetBrains.
More: 404 "The target couldn't be found." and "not found" · 401 "token is required" and unknown tokens · "token does not have at least one of required scope(s)" · Forgejo and Gitea search refused (400, 422) · Forgejo and Gitea merge refused (405, 409) · Forgejo and Gitea merge when checks succeed refused (405, 409, 500) · Forgejo and Gitea review refused (422) · Forgejo and Gitea branch update refused (403, 409, 422) · Forgejo and Gitea pull request not created (409, 422, 403) · Forgejo and Gitea comment refused (403, 422, 400) · Forgejo and Gitea pull request plugins for IntelliJ IDEA, compared · 日本語