move agit dependcy (#19998)
This commit is contained in:
parent
719eb4a879
commit
27ba86d283
2 changed files with 29 additions and 61 deletions
|
@ -8,8 +8,10 @@ package private
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
gitea_context "code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/agit"
|
||||
|
@ -23,8 +25,17 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
|
|||
return
|
||||
}
|
||||
|
||||
results := agit.ProcReceive(ctx, opts)
|
||||
if ctx.Written() {
|
||||
results, err := agit.ProcReceive(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, opts)
|
||||
if err != nil {
|
||||
if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
|
||||
} else {
|
||||
log.Error(err.Error())
|
||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||
"Err": err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue