mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-08 12:02:56 +02:00
fix(repo): surface unrelated histories on Sync Fork (#39258)
Sync Fork already maps merge conflicts to a JSON error. Unrelated histories still went through `ServerError`, so the UI showed a 500 HTML snippet instead of the same user-facing message PR merge already uses (`repo.pulls.unrelated_histories`). The API path returned 500 for the same git error; PR merge returns 409. Match that. Fixes #36772 AI assistance was used to locate the handler gap and draft the mapping. I reviewed and take responsibility for the change. Signed-off-by: Zhaoqi Xu <lzy00419@outlook.com>
This commit is contained in:
1 parent
afb7edef07
commit
be7cde7539
4 files changed
+14
No files matched your search
@@ -240,6 +240,9 @@ func MergeUpstream(ctx *context.Context) {
|
||||
} else if pull_service.IsErrMergeConflicts(err) {
|
||||
ctx.JSONError(ctx.Tr("repo.pulls.merge_conflict"))
|
||||
return
|
||||
} else if pull_service.IsErrMergeUnrelatedHistories(err) {
|
||||
ctx.JSONError(ctx.Tr("repo.pulls.unrelated_histories"))
|
||||
return
|
||||
}
|
||||
ctx.ServerError("MergeUpstream", err)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user