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 committed 2026-08-13 13:02:45 +00:00
1 parent 0d2c4a3cb6
commit a1ffcaffd2
4 files changed
+38 -4

No files matched your search

+17
View File
@@ -144,6 +144,23 @@ final class PRDetailViewModel: ObservableObject {
pr = try? await client.pullRequest(owner: owner, repo: repo.name,
number: prNumber)
return true
} catch APIError.mergeConflict {
// Branch is behind main (or conflicts). Update it and retry once.
busyMessage = "Updating branch…"
do {
try await client.updateBranch(owner: owner, repo: repo.name,
number: prNumber)
busyMessage = "Merging…"
try await client.merge(owner: owner, repo: repo.name,
number: prNumber, method: method,
deleteBranchAfterMerge: SettingsStore.shared.deleteBranchAfterMerge)
pr = try? await client.pullRequest(owner: owner, repo: repo.name,
number: prNumber)
return true
} catch {
errorMessage = error.localizedDescription
return false
}
} catch {
errorMessage = error.localizedDescription
return false