mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-15 09:58:28 -07:00
This commit is contained in:
parent
a3928fd820
commit
9409ac9030
@ -480,6 +480,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() {
|
||||
log.Trace("Doing: DeletedBranchesCleanup")
|
||||
|
@ -453,10 +453,15 @@ func PushUpdate(repo *models.Repository, branch string, opts models.PushUpdateOp
|
||||
}
|
||||
}
|
||||
} else if !isDelRef {
|
||||
branchName := opts.RefFullName[len(git.BranchPrefix):]
|
||||
if err = models.RemoveDeletedBranch(repo.ID, branchName); err != nil {
|
||||
log.Error("models.RemoveDeletedBranch %s/%s failed: %v", repo.ID, branchName, err)
|
||||
}
|
||||
|
||||
// If is branch reference
|
||||
|
||||
// Clear cache for branch commit count
|
||||
cache.Remove(repo.GetCommitsCountCacheKey(opts.RefFullName[len(git.BranchPrefix):], true))
|
||||
cache.Remove(repo.GetCommitsCountCacheKey(branchName, true))
|
||||
|
||||
newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user