aboutsummaryrefslogtreecommitdiffstats
path: root/models/branches.go
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2019-11-16 20:39:18 +0100
committerzeripath <art27@cantab.net>2019-11-16 19:39:18 +0000
commit86cff86b46116353e4d6605ccf5a77a7ac65bc78 (patch)
treec4b0cefc24d333f64682d9b31a91ad42406a6aef /models/branches.go
parent3dfe9190b05b68497478324a776c1f80d6f5e56d (diff)
downloadgitea-86cff86b46116353e4d6605ccf5a77a7ac65bc78.tar.gz
gitea-86cff86b46116353e4d6605ccf5a77a7ac65bc78.zip
Update branch API endpoint to show effective branch protection. (#9031)
* Add API endpoint for displaying effective branch protection. * Add status checks.
Diffstat (limited to 'models/branches.go')
-rw-r--r--models/branches.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go
index c5f227f1e5..46670b18a0 100644
--- a/models/branches.go
+++ b/models/branches.go
@@ -242,6 +242,11 @@ func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error) {
return protectedBranches, x.Find(&protectedBranches, &ProtectedBranch{RepoID: repo.ID})
}
+// GetBranchProtection get the branch protection of a branch
+func (repo *Repository) GetBranchProtection(branchName string) (*ProtectedBranch, error) {
+ return GetProtectedBranchBy(repo.ID, branchName)
+}
+
// IsProtectedBranch checks if branch is protected
func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error) {
if doer == nil {