mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							39da4ac6d4
						
					
				
				
					commit
					d15e49f7ff
				
			@@ -162,6 +162,12 @@ func loadBranches(ctx *context.Context) []*Branch {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protectedBranches, err := ctx.Repo.Repository.GetProtectedBranches()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		ctx.ServerError("GetProtectedBranches", err)
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	branches := make([]*Branch, len(rawBranches))
 | 
			
		||||
	for i := range rawBranches {
 | 
			
		||||
		commit, err := rawBranches[i].GetCommit()
 | 
			
		||||
@@ -170,11 +176,13 @@ func loadBranches(ctx *context.Context) []*Branch {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		var isProtected bool
 | 
			
		||||
		branchName := rawBranches[i].Name
 | 
			
		||||
		isProtected, err := ctx.Repo.Repository.IsProtectedBranch(branchName, ctx.User)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			ctx.ServerError("IsProtectedBranch", err)
 | 
			
		||||
			return nil
 | 
			
		||||
		for _, b := range protectedBranches {
 | 
			
		||||
			if b.BranchName == branchName {
 | 
			
		||||
				isProtected = true
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		divergence, divergenceError := repofiles.CountDivergingCommits(ctx.Repo.Repository, branchName)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user