mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 20:24:12 +01:00
[ACTIONS] port scheduled actions from Gitea
Refs: https://codeberg.org/forgejo/forgejo/issues/2798
This commit is contained in:
parent
52e9d2db06
commit
a117dfd2b1
3 changed files with 6 additions and 7 deletions
|
@ -6,12 +6,11 @@ package setting
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/gitrepo"
|
||||
git_model "code.gitea.io/gitea/models/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/routers/web/repo"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
|
@ -37,7 +36,7 @@ func SetDefaultBranchPost(ctx *context.Context) {
|
|||
branch := ctx.FormString("branch")
|
||||
if err := repo_service.SetRepoDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, branch); err != nil {
|
||||
switch {
|
||||
case ctx.Repo.GitRepo.IsErrBranchNotExist(err):
|
||||
case git_model.IsErrBranchNotExist(err):
|
||||
ctx.Status(http.StatusNotFound)
|
||||
default:
|
||||
ctx.ServerError("SetDefaultBranch", err)
|
||||
|
|
|
@ -381,7 +381,7 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_m
|
|||
log.Error("CancelPreviousJobs: %v", err)
|
||||
}
|
||||
|
||||
err2 = gitRepo.SetDefaultBranch(ctx, repo, to)
|
||||
err2 = gitrepo.SetDefaultBranch(ctx, repo, to)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitR
|
|||
log.Error("CancelPreviousJobs: %v", err)
|
||||
}
|
||||
|
||||
if err := gitRepo.SetDefaultBranch(newBranchName); err != nil {
|
||||
if err := gitrepo.SetDefaultBranch(ctx, repo, newBranchName); err != nil {
|
||||
if !git.IsErrUnsupportedVersion(err) {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -635,7 +635,7 @@ func CreateDeclarativeRepo(t *testing.T, owner *user_model.User, name string, en
|
|||
}
|
||||
}
|
||||
|
||||
err := repo_model.UpdateRepositoryUnits(db.DefaultContext, repo, units, disabledUnits)
|
||||
err := repo_service.UpdateRepositoryUnits(db.DefaultContext, repo, units, disabledUnits)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue