diff options
author | 6543 <6543@obermui.de> | 2021-03-22 18:03:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-22 18:03:18 +0100 |
commit | 5f038cd7febd834c9b86b9e734848870efbdce86 (patch) | |
tree | 8b3e9b8fd52c537766d3fd05c56d0ff90a7aa6da /modules/migrations | |
parent | 8567cba0d978e6ab68c337c0a80244704a15718a (diff) | |
download | gitea-5f038cd7febd834c9b86b9e734848870efbdce86.tar.gz gitea-5f038cd7febd834c9b86b9e734848870efbdce86.zip |
[Vendor] update gitea-sdk v0.14.0 (#15103)
* upgraded code.gitea.io/sdk/gitea v0.13.2 => v0.14.0
* rm workaround
Diffstat (limited to 'modules/migrations')
-rw-r--r-- | modules/migrations/gitea_downloader.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/modules/migrations/gitea_downloader.go b/modules/migrations/gitea_downloader.go index 87ec9c102a..40820ae375 100644 --- a/modules/migrations/gitea_downloader.go +++ b/modules/migrations/gitea_downloader.go @@ -525,9 +525,6 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques headRepoName = pr.Head.Repository.Name headCloneURL = pr.Head.Repository.CloneURL } - if err := fixPullHeadSha(g.client, pr); err != nil { - return nil, false, fmt.Errorf("error while resolving head git ref: %s for pull #%d. Error: %v", pr.Head.Ref, pr.Index, err) - } headSHA = pr.Head.Sha headRef = pr.Head.Ref } @@ -679,22 +676,3 @@ func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error) { } return allReviews, nil } - -// fixPullHeadSha is a workaround for https://github.com/go-gitea/gitea/issues/12675 -// When no head sha is available, this is because the branch got deleted in the base repo. -// pr.Head.Ref points in this case not to the head repo branch name, but the base repo ref, -// which stays available to resolve the commit sha. -func fixPullHeadSha(client *gitea_sdk.Client, pr *gitea_sdk.PullRequest) error { - owner := pr.Base.Repository.Owner.UserName - repo := pr.Base.Repository.Name - if pr.Head != nil && pr.Head.Sha == "" { - refs, _, err := client.GetRepoRefs(owner, repo, pr.Head.Ref) - if err != nil { - return err - } else if len(refs) == 0 { - return fmt.Errorf("unable to resolve PR ref '%s'", pr.Head.Ref) - } - pr.Head.Sha = refs[0].Object.SHA - } - return nil -} |