Auto-update branch when merge conflicts (branch behind main); bump to 2.6
Build iOS App / Build .ipa and publish source (push) Successful in 22s

When a PR's head branch is behind main (or conflicts), Gitea's merge returns
409. Previously the app just showed an error. Now: on a 409 the app calls
POST /pulls/{index}/update (merges base into head), then retries the merge
once. Add APIError.mergeConflict for a clear message and map 409 in the
client. Bump to 2.6.
This commit is contained in:
Hermes
2026-08-13 13:02:45 +00:00
parent 0d2c4a3cb6
commit a1ffcaffd2
4 changed files with 38 additions and 4 deletions
+6
View File
@@ -7,6 +7,7 @@ enum APIError: LocalizedError, Equatable {
case decoding(String)
case unauthorized
case notFound
case mergeConflict
var errorDescription: String? {
switch self {
@@ -18,6 +19,9 @@ enum APIError: LocalizedError, Equatable {
if code == 401 || code == 403 {
return "Authentication failed. Check your token."
}
if code == 409 {
return "This branch is out of date or conflicts with the base branch. Update the branch and try again."
}
return message?.isEmpty == false
? "Server error (\(code)): \(message!)"
: "Server error (\(code))."
@@ -27,6 +31,8 @@ enum APIError: LocalizedError, Equatable {
return "Authentication failed. Check your token."
case .notFound:
return "Not found."
case .mergeConflict:
return "This branch is out of date or conflicts with the base branch. Update the branch and try again."
}
}
}