Skip to content

Commit 7939780

Browse files
committed
limit scope
1 parent b939a8d commit 7939780

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

routers/api/v1/repo/branch.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ func CreateBranchProtection(ctx *context.APIContext) {
645645
BlockOnOutdatedBranch: form.BlockOnOutdatedBranch,
646646
}
647647

648-
err = git_model.UpdateProtectBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
648+
if err := git_model.UpdateProtectBranch(ctx, ctx.Repo.Repository, protectBranch, git_model.WhitelistOptions{
649649
UserIDs: whitelistUsers,
650650
TeamIDs: whitelistTeams,
651651
ForcePushUserIDs: forcePushAllowlistUsers,
@@ -654,14 +654,13 @@ func CreateBranchProtection(ctx *context.APIContext) {
654654
MergeTeamIDs: mergeWhitelistTeams,
655655
ApprovalsUserIDs: approvalsWhitelistUsers,
656656
ApprovalsTeamIDs: approvalsWhitelistTeams,
657-
})
658-
if err != nil {
657+
}); err != nil {
659658
ctx.Error(http.StatusInternalServerError, "UpdateProtectBranch", err)
660659
return
661660
}
662661

663662
if isBranchExist {
664-
if err = pull_service.CheckPRsForBaseBranch(ctx, ctx.Repo.Repository, ruleName); err != nil {
663+
if err := pull_service.CheckPRsForBaseBranch(ctx, ctx.Repo.Repository, ruleName); err != nil {
665664
ctx.Error(http.StatusInternalServerError, "CheckPRsForBaseBranch", err)
666665
return
667666
}

0 commit comments

Comments
 (0)