mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 06:39:17 +01:00
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.
This commit is contained in:
parent
5a76759c9c
commit
8faa38568b
1 changed files with 6 additions and 1 deletions
|
@ -566,6 +566,11 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
|
||||||
closeTime = pr.UpdatedAt
|
closeTime = pr.UpdatedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mergeCommitSHA := pr.MergeCommitSHA
|
||||||
|
if mergeCommitSHA == "" {
|
||||||
|
mergeCommitSHA = pr.SquashCommitSHA
|
||||||
|
}
|
||||||
|
|
||||||
var locked bool
|
var locked bool
|
||||||
if pr.State == "locked" {
|
if pr.State == "locked" {
|
||||||
locked = true
|
locked = true
|
||||||
|
@ -608,7 +613,7 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
|
||||||
Closed: closeTime,
|
Closed: closeTime,
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Merged: merged,
|
Merged: merged,
|
||||||
MergeCommitSHA: pr.MergeCommitSHA,
|
MergeCommitSHA: mergeCommitSHA,
|
||||||
MergedTime: mergeTime,
|
MergedTime: mergeTime,
|
||||||
IsLocked: locked,
|
IsLocked: locked,
|
||||||
Reactions: g.awardsToReactions(reactions),
|
Reactions: g.awardsToReactions(reactions),
|
||||||
|
|
Loading…
Reference in a new issue