1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-12 13:28:30 +00:00

Return 409 when gc conflict (#731)

* Return 409 when gc conflict

* Go return 409 when gc conflict

* Return gc conflict when sync repo

---------

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-12-30 15:03:54 +08:00
committed by GitHub
parent de62852244
commit ee9ad5ef39
6 changed files with 62 additions and 16 deletions

View File

@@ -1077,8 +1077,12 @@ func putUpdateBranchCB(rsp http.ResponseWriter, r *http.Request) *appError {
token = utils.GetAuthorizationToken(r.Header)
}
if err := fastForwardOrMerge(user, token, repo, base, newCommit); err != nil {
err := fmt.Errorf("Fast forward merge for repo %s is failed: %v", repoID, err)
return &appError{err, "", http.StatusInternalServerError}
if errors.Is(err, ErrGCConflict) {
return &appError{nil, "GC Conflict.\n", http.StatusConflict}
} else {
err := fmt.Errorf("Fast forward merge for repo %s is failed: %v", repoID, err)
return &appError{err, "", http.StatusInternalServerError}
}
}
go mergeVirtualRepoPool.AddTask(repoID, "")