|
|
@ -128,10 +128,7 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g |
|
|
|
p := protectedBranches.GetFirstMatched(branchName) |
|
|
|
p := protectedBranches.GetFirstMatched(branchName) |
|
|
|
isProtected := p != nil |
|
|
|
isProtected := p != nil |
|
|
|
|
|
|
|
|
|
|
|
divergence := &git.DivergeObject{ |
|
|
|
var divergence *git.DivergeObject |
|
|
|
Ahead: -1, |
|
|
|
|
|
|
|
Behind: -1, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// it's not default branch
|
|
|
|
// it's not default branch
|
|
|
|
if repo.DefaultBranch != dbBranch.Name && !dbBranch.IsDeleted { |
|
|
|
if repo.DefaultBranch != dbBranch.Name && !dbBranch.IsDeleted { |
|
|
@ -142,6 +139,11 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if divergence == nil { |
|
|
|
|
|
|
|
// tolerate error that we can't get divergence
|
|
|
|
|
|
|
|
divergence = &git.DivergeObject{Ahead: -1, Behind: -1} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pr, err := issues_model.GetLatestPullRequestByHeadInfo(repo.ID, branchName) |
|
|
|
pr, err := issues_model.GetLatestPullRequestByHeadInfo(repo.ID, branchName) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("GetLatestPullRequestByHeadInfo: %v", err) |
|
|
|
return nil, fmt.Errorf("GetLatestPullRequestByHeadInfo: %v", err) |
|
|
|