Skip to content

fix(list): filter the Gitea open-PR lookup by head branch for same-repo branches - #4864

Merged
max-sixty merged 1 commit into
mainfrom
fix/gitea-pr-head-filter
Nov 20, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/gitea-pr-head-filter

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

wt list --full and the statusline found a same-repo branch's Gitea/Forgejo PR only if it was among the repository's first 20 open PRs (#4746). Following the direction agreed on the issue, a same-repo branch now adds &head=<branch> to the existing tea api .../pulls?state=open&limit=20 request. It stays one call:

The client-side branch + owner match is unchanged. A fork branch keeps the unfiltered request. Forgejo wants the bare name and new Gitea wants owner:branch, and each form matches nothing on the other server. "Same-repo" means the branch's push remote resolves to the same owner/repo as the primary remote, compared case-insensitively. The branch name is percent-encoded, so feat/a&b stays one head value.

Tests. setup_mock_tea_with_ci_data now registers the pulls response per head= filter, or as the unfiltered path when given none. The same-repo Gitea wt list --full tests register the filtered paths and the fork test (test_list_full_with_gitea_fork_pr) registers the unfiltered one. With the gitea.rs change reverted, five same-repo tests fail because their requests miss the registered paths. With the change, all 34 Gitea integration tests pass. test_open_pulls_path pins the path and its encoding. Nothing here was run against a live Gitea or Forgejo server. The server behavior comes from reading their source, as detailed on the issue.

Closes #4746

…ranches

`wt list --full` found a same-repo branch's Gitea/Forgejo PR only if it was
among the first 20 open PRs. Same-repo branches now add `&head=<branch>` to
the one `tea api .../pulls` call: Forgejo 16+ filters on it, Gitea will once
go-gitea/gitea#40164 ships, and older servers ignore the parameter and return
the same first page as before. The client-side match is unchanged. Fork
branches keep the unfiltered request, since Forgejo and new Gitea read the
`head` value in incompatible forms.

Closes #4746
@max-sixty
max-sixty merged commit 7620311 into main Nov 20, 2026
36 checks passed
@max-sixty
max-sixty deleted the fix/gitea-pr-head-filter branch November 20, 2026 19:38
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.

Gitea CI status misses a branch's PR when the repository has more than 20 open PRs

2 participants