Fix deleted branch isn't removed when push the branch again (#9516)

This commit is contained in:
Lunny Xiao 2019-12-28 03:17:37 +08:00 committed by zeripath
parent e3a5b83212
commit 0bcf644da4
2 changed files with 12 additions and 0 deletions

View file

@ -525,6 +525,12 @@ func (deletedBranch *DeletedBranch) LoadUser() {
deletedBranch.DeletedBy = user
}
// RemoveDeletedBranch removes all deleted branches
func RemoveDeletedBranch(repoID int64, branch string) error {
_, err := x.Where("repo_id=? AND name=?", repoID, branch).Delete(new(DeletedBranch))
return err
}
// RemoveOldDeletedBranches removes old deleted branches
func RemoveOldDeletedBranches(ctx context.Context) {
// Nothing to do for shutdown or terminate