mirror of
https://gitea.com/gitea/tea.git
synced 2026-09-11 16:06:36 -04:00
`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>
|
||
|---|---|---|
| .. | ||
| api | ||
| auth | ||
| config | ||
| context | ||
| debug | ||
| filelock | ||
| git | ||
| httputil | ||
| interact | ||
| task | ||
| theme | ||
| utils | ||
| version | ||