mirror of
https://github.com/go-gitea/gitea
synced 2025-01-24 08:34:28 +00:00
Backport #33120 by changchaishi fixes #33119 Co-authored-by: Chai-Shi <changchaishi@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
9899989ece
commit
63b3a33bf2
@ -46,6 +46,12 @@ func UpdateRepositoryCols(ctx context.Context, repo *Repository, cols ...string)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateRepositoryColsNoAutoTime updates repository's columns and but applies time change automatically
|
||||||
|
func UpdateRepositoryColsNoAutoTime(ctx context.Context, repo *Repository, cols ...string) error {
|
||||||
|
_, err := db.GetEngine(ctx).ID(repo.ID).Cols(cols...).NoAutoTime().Update(repo)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
|
// ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
|
||||||
type ErrReachLimitOfRepo struct {
|
type ErrReachLimitOfRepo struct {
|
||||||
Limit int
|
Limit int
|
||||||
|
@ -224,11 +224,14 @@ func prepareRecentlyPushedNewBranches(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateContextRepoEmptyAndStatus(ctx *context.Context, empty bool, status repo_model.RepositoryStatus) {
|
func updateContextRepoEmptyAndStatus(ctx *context.Context, empty bool, status repo_model.RepositoryStatus) {
|
||||||
|
if ctx.Repo.Repository.IsEmpty == empty && ctx.Repo.Repository.Status == status {
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.Repo.Repository.IsEmpty = empty
|
ctx.Repo.Repository.IsEmpty = empty
|
||||||
if ctx.Repo.Repository.Status == repo_model.RepositoryReady || ctx.Repo.Repository.Status == repo_model.RepositoryBroken {
|
if ctx.Repo.Repository.Status == repo_model.RepositoryReady || ctx.Repo.Repository.Status == repo_model.RepositoryBroken {
|
||||||
ctx.Repo.Repository.Status = status // only handle ready and broken status, leave other status as-is
|
ctx.Repo.Repository.Status = status // only handle ready and broken status, leave other status as-is
|
||||||
}
|
}
|
||||||
if err := repo_model.UpdateRepositoryCols(ctx, ctx.Repo.Repository, "is_empty", "status"); err != nil {
|
if err := repo_model.UpdateRepositoryColsNoAutoTime(ctx, ctx.Repo.Repository, "is_empty", "status"); err != nil {
|
||||||
ctx.ServerError("updateContextRepoEmptyAndStatus: UpdateRepositoryCols", err)
|
ctx.ServerError("updateContextRepoEmptyAndStatus: UpdateRepositoryCols", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user