|
|
@ -158,10 +158,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 { |
|
|
@ -180,6 +177,11 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if divergence == nil { |
|
|
|
|
|
|
|
// tolerate the error that we cannot get divergence
|
|
|
|
|
|
|
|
divergence = &git.DivergeObject{Ahead: -1, Behind: -1} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pr, err := issues_model.GetLatestPullRequestByHeadInfo(ctx, repo.ID, branchName) |
|
|
|
pr, err := issues_model.GetLatestPullRequestByHeadInfo(ctx, repo.ID, branchName) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("GetLatestPullRequestByHeadInfo: %v", err) |
|
|
|
return nil, fmt.Errorf("GetLatestPullRequestByHeadInfo: %v", err) |
|
|
|