瀏覽代碼

Use GitLab's squash_commit_sha when available (#27824)

Before this PR, the PR migration code populates Gitea's MergedCommitID
field by using GitLab's merge_commit_sha field. However, that field is
only populated when the PR was merged using a merge strategy. When a
squash strategy is used, squash_commit_sha is populated instead.

Given that Gitea does not keep track of merge and squash commits
separately, this PR simply populates Gitea's MergedCommitID by using
whichever field is present in the GitLab API response.
tags/v1.22.0-rc0
Sebastian Brückner 7 月之前
父節點
當前提交
8faa38568b
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 6 行新增1 行删除
  1. 6
    1
      services/migrations/gitlab.go

+ 6
- 1
services/migrations/gitlab.go 查看文件

@@ -566,6 +566,11 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
closeTime = pr.UpdatedAt
}

mergeCommitSHA := pr.MergeCommitSHA
if mergeCommitSHA == "" {
mergeCommitSHA = pr.SquashCommitSHA
}

var locked bool
if pr.State == "locked" {
locked = true
@@ -608,7 +613,7 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
Closed: closeTime,
Labels: labels,
Merged: merged,
MergeCommitSHA: pr.MergeCommitSHA,
MergeCommitSHA: mergeCommitSHA,
MergedTime: mergeTime,
IsLocked: locked,
Reactions: g.awardsToReactions(reactions),

Loading…
取消
儲存