diff options
author | Lauris BH <lauris@nix.lv> | 2020-03-27 00:26:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 00:26:34 +0200 |
commit | bbd910ed1b4f52ee66a5cdd8d11f856598161bef (patch) | |
tree | 8392e0f8208b5b7d8e6df8335677518aa07f194f /routers/api/v1 | |
parent | 52cfd2743c0e85b36081cf80a850e6a5901f1865 (diff) | |
download | gitea-bbd910ed1b4f52ee66a5cdd8d11f856598161bef.tar.gz gitea-bbd910ed1b4f52ee66a5cdd8d11f856598161bef.zip |
Allow to set protected file patterns that can not be changed under no conditions (#10806)
Co-Authored-By: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/repo/branch.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go index 0d4501cd79..56a9b5ec25 100644 --- a/routers/api/v1/repo/branch.go +++ b/routers/api/v1/repo/branch.go @@ -339,6 +339,7 @@ func CreateBranchProtection(ctx *context.APIContext, form api.CreateBranchProtec BlockOnRejectedReviews: form.BlockOnRejectedReviews, DismissStaleApprovals: form.DismissStaleApprovals, RequireSignedCommits: form.RequireSignedCommits, + ProtectedFilePatterns: form.ProtectedFilePatterns, } err = models.UpdateProtectBranch(ctx.Repo.Repository, protectBranch, models.WhitelistOptions{ @@ -470,6 +471,10 @@ func EditBranchProtection(ctx *context.APIContext, form api.EditBranchProtection protectBranch.RequireSignedCommits = *form.RequireSignedCommits } + if form.ProtectedFilePatterns != nil { + protectBranch.ProtectedFilePatterns = *form.ProtectedFilePatterns + } + var whitelistUsers []int64 if form.PushWhitelistUsernames != nil { whitelistUsers, err = models.GetUserIDsByNames(form.PushWhitelistUsernames, false) |