Skip to content

Commit 7ac88ae

Browse files
committed
Remove unnecessary function
1 parent b93b534 commit 7ac88ae

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

models/branches.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,6 @@ func GetProtectedBranches(repoID int64) ([]*ProtectedBranch, error) {
399399
return protectedBranches, db.GetEngine(db.DefaultContext).Find(&protectedBranches, &ProtectedBranch{RepoID: repoID})
400400
}
401401

402-
// GetBranchProtection get the branch protection of a branch
403-
func GetBranchProtection(repoID int64, branchName string) (*ProtectedBranch, error) {
404-
return GetProtectedBranchBy(repoID, branchName)
405-
}
406-
407402
// IsProtectedBranch checks if branch is protected
408403
func IsProtectedBranch(repoID int64, branchName string) (bool, error) {
409404
protectedBranch := &ProtectedBranch{

routers/api/v1/repo/branch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func GetBranch(ctx *context.APIContext) {
6969
return
7070
}
7171

72-
branchProtection, err := models.GetBranchProtection(ctx.Repo.Repository.ID, branchName)
72+
branchProtection, err := models.GetProtectedBranchBy(ctx.Repo.Repository.ID, branchName)
7373
if err != nil {
7474
ctx.Error(http.StatusInternalServerError, "GetBranchProtection", err)
7575
return
@@ -210,7 +210,7 @@ func CreateBranch(ctx *context.APIContext) {
210210
return
211211
}
212212

213-
branchProtection, err := models.GetBranchProtection(ctx.Repo.Repository.ID, branch.Name)
213+
branchProtection, err := models.GetProtectedBranchBy(ctx.Repo.Repository.ID, branch.Name)
214214
if err != nil {
215215
ctx.Error(http.StatusInternalServerError, "GetBranchProtection", err)
216216
return
@@ -270,7 +270,7 @@ func ListBranches(ctx *context.APIContext) {
270270
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
271271
return
272272
}
273-
branchProtection, err := models.GetBranchProtection(ctx.Repo.Repository.ID, branches[i].Name)
273+
branchProtection, err := models.GetProtectedBranchBy(ctx.Repo.Repository.ID, branches[i].Name)
274274
if err != nil {
275275
ctx.Error(http.StatusInternalServerError, "GetBranchProtection", err)
276276
return

services/repository/files/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ func CreateOrUpdateRepoFile(repo *repo_model.Repository, doer *user_model.User,
442442

443443
// VerifyBranchProtection verify the branch protection for modifying the given treePath on the given branch
444444
func VerifyBranchProtection(repo *repo_model.Repository, doer *user_model.User, branchName string, treePath string) error {
445-
protectedBranch, err := models.GetBranchProtection(repo.ID, branchName)
445+
protectedBranch, err := models.GetProtectedBranchBy(repo.ID, branchName)
446446
if err != nil {
447447
return err
448448
}

0 commit comments

Comments
 (0)