From e4f187cd3d7e7cbc69b1bdf9ec58b4191c67aa7d Mon Sep 17 00:00:00 2001 From: Wendell Sun Date: Wed, 7 Mar 2018 06:11:31 +0800 Subject: [PATCH] models: bug fix for query protected branches (#5054) Signed-off-by: Wendell Sun --- models/repo_branch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/repo_branch.go b/models/repo_branch.go index 76fd592fb..10931b0c3 100644 --- a/models/repo_branch.go +++ b/models/repo_branch.go @@ -252,5 +252,5 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit // GetProtectBranchesByRepoID returns a list of *ProtectBranch in given repostiory. func GetProtectBranchesByRepoID(repoID int64) ([]*ProtectBranch, error) { protectBranches := make([]*ProtectBranch, 0, 2) - return protectBranches, x.Where("repo_id = ?", repoID).Asc("name").Find(&protectBranches) + return protectBranches, x.Where("repo_id = ? and protected=true", repoID).Asc("name").Find(&protectBranches) }