Skip to content

Commit 3167f20

Browse files
committed
don't return if get pull request commit id failed
1 parent 997a930 commit 3167f20

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

services/convert/pull.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,6 @@ func ToAPIPullRequests(ctx context.Context, baseRepo *repo_model.Repository, prs
441441
if apiPullRequest.Head.Ref == "" {
442442
apiPullRequest.Head.Ref = pr.GetGitRefName()
443443
}
444-
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitID(pr.GetGitRefName())
445-
if err != nil {
446-
log.Error("GetRefCommitID[%s]: %v", pr.GetGitRefName(), err)
447-
return nil, err
448-
}
449444

450445
if pr.HeadRepoID == pr.BaseRepoID {
451446
apiPullRequest.Head.Repository = apiPullRequest.Base.Repository
@@ -461,6 +456,10 @@ func ToAPIPullRequests(ctx context.Context, baseRepo *repo_model.Repository, prs
461456
if pr.Flow == issues_model.PullRequestFlowAGit {
462457
apiPullRequest.Head.Name = ""
463458
}
459+
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitID(pr.GetGitRefName())
460+
if err != nil {
461+
log.Error("GetRefCommitID[%s]: %v", pr.GetGitRefName(), err)
462+
}
464463

465464
if len(apiPullRequest.Head.Sha) == 0 && len(apiPullRequest.Head.Ref) != 0 {
466465
refs, err := gitRepo.GetRefsFiltered(apiPullRequest.Head.Ref)

0 commit comments

Comments
 (0)