gitea.tea/modules
Jan Baer 06f772f172 fix(pulls): report the real reason when a merge is refused
`tea pr merge <index>` reported the same misleading error for every refusal:

    failed to merge PR, is it still open?

The PR usually is still open — `tea pr <index>` shows it as open and lists
`Conflicting files` — so the message sends users the wrong way.

Gitea answers an unmergeable PR with a 405 and a body naming the cause, but the
SDK's MergePullRequest is built on getStatusCode, which returns only the status
code and never calls statusCodeToErr. tea receives success=false, err=nil with no
server explanation to pass on, so it guessed.

Changes:

- Derive the reason from the PR when a merge fails: already merged, closed,
  draft, or not mergeable.
- When the PR looks mergeable but was refused anyway, name the conditions tea
  cannot observe (required status checks, requested reviews, branch protection).
- Include the PR index in the error.
- Add table-driven tests for every reason, plus a failed follow-up lookup.

The extra API call happens only on the failure path.

Fixes #1022

Signed-off-by: Jan Baer <jan.s.baer@googlemail.com>
2026-08-31 13:31:48 +02:00
..
api fix(http): add transport timeouts so tea fails fast on stalled servers (#1020) 2026-06-26 19:59:05 +00:00
auth fix(oauth): don't wait for the browser opener to exit (#1093) 2026-08-16 12:57:47 +00:00
config feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
context fix(context): clarify the fallback login prompt wording (#1061) 2026-07-26 01:38:10 +00:00
debug add debug mode and update readme (#805) 2025-09-10 19:10:02 +00:00
filelock Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888) 2026-02-05 18:05:43 +00:00
git Add reply to code review (#978) 2026-06-26 21:40:31 +00:00
httputil fix(http): add transport timeouts so tea fails fast on stalled servers (#1020) 2026-06-26 19:59:05 +00:00
interact fix(login): avoid panic when parsing auto-discovered SSH keys (#1100) 2026-08-23 19:20:19 +00:00
print feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
task fix(pulls): report the real reason when a merge is refused 2026-08-31 13:31:48 +02:00
theme fix(theme): don't query the terminal at start-up (#1054) 2026-07-13 04:31:26 +00:00
utils feat(pulls): add --draft to create and --draft/--ready to edit (#1008) 2026-05-31 02:50:32 +00:00
version Move versions/filelocker into dedicated subpackages, and consistent headers in http requests (#888) 2026-02-05 18:05:43 +00:00