diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-01-13 05:50:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-12 21:50:38 +0000 |
commit | 97292da96048b036cbe36b3ea66503ac568a73e7 (patch) | |
tree | 3104c11d619e6b11a82d6a898354dc4cf64ed0be /models/git/branch.go | |
parent | 6c6823935c4810a071a3919a88819b0ed156bf43 (diff) | |
download | gitea-97292da96048b036cbe36b3ea66503ac568a73e7.tar.gz gitea-97292da96048b036cbe36b3ea66503ac568a73e7.zip |
Fix schedule tasks bugs (#28691)
Fix #28157
This PR fix the possible bugs about actions schedule.
## The Changes
- Move `UpdateRepositoryUnit` and `SetRepoDefaultBranch` from models to
service layer
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when actions unit has been disabled
or global disabled.
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when default branch changed.
Diffstat (limited to 'models/git/branch.go')
-rw-r--r-- | models/git/branch.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/git/branch.go b/models/git/branch.go index ffd1d7ed16..db02fc9b28 100644 --- a/models/git/branch.go +++ b/models/git/branch.go @@ -283,7 +283,7 @@ func FindRenamedBranch(ctx context.Context, repoID int64, from string) (branch * } // RenameBranch rename a branch -func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to string, gitAction func(isDefault bool) error) (err error) { +func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to string, gitAction func(ctx context.Context, isDefault bool) error) (err error) { ctx, committer, err := db.TxContext(ctx) if err != nil { return err @@ -358,7 +358,7 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to str } // 5. do git action - if err = gitAction(isDefault); err != nil { + if err = gitAction(ctx, isDefault); err != nil { return err } |