summaryrefslogtreecommitdiffstats
path: root/models/branches.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-12-28 03:17:37 +0800
committerzeripath <art27@cantab.net>2019-12-27 19:17:37 +0000
commit0bcf644da4c3d21fad3ce8f33ccc26f8110568d6 (patch)
tree06f6f7c4d21efff1fa49439b671f492e8f01e409 /models/branches.go
parente3a5b8321240e489bb9048ecf2caccf73c0abc36 (diff)
downloadgitea-0bcf644da4c3d21fad3ce8f33ccc26f8110568d6.tar.gz
gitea-0bcf644da4c3d21fad3ce8f33ccc26f8110568d6.zip
Fix deleted branch isn't removed when push the branch again (#9516)
Diffstat (limited to 'models/branches.go')
-rw-r--r--models/branches.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go
index 045019314a..21b23c75d9 100644
--- a/models/branches.go
+++ b/models/branches.go
@@ -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