diff options
author | 6543 <6543@obermui.de> | 2020-11-20 00:18:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-20 01:18:34 +0200 |
commit | 24b3b2140a094a108707c2994946b5a99eda016f (patch) | |
tree | a774aa734f6acf71078abf5b970e0222b6f9af52 /modules/migrations | |
parent | 702e82d162d2c3aaee133201cfd4edb8e67017f9 (diff) | |
download | gitea-24b3b2140a094a108707c2994946b5a99eda016f.tar.gz gitea-24b3b2140a094a108707c2994946b5a99eda016f.zip |
finaly fix gitlab migration with subdir 2.0 (#13646)
* final fix 2.0?
* ignore Approvals for pulls if not found
* CI.restart()
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/migrations')
-rw-r--r-- | modules/migrations/gitlab.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/migrations/gitlab.go b/modules/migrations/gitlab.go index c510944f6f..b1027c4f64 100644 --- a/modules/migrations/gitlab.go +++ b/modules/migrations/gitlab.go @@ -92,7 +92,7 @@ func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, passw pathParts := strings.Split(strings.Trim(repoPath, "/"), "/") var resp *gitlab.Response u, _ := url.Parse(baseURL) - for len(pathParts) > 2 { + for len(pathParts) >= 2 { _, resp, err = gitlabClient.Version.GetVersion() if err == nil || resp != nil && resp.StatusCode == 401 { err = nil // if no authentication given, this still should work @@ -609,8 +609,12 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque // GetReviews returns pull requests review func (g *GitlabDownloader) GetReviews(pullRequestNumber int64) ([]*base.Review, error) { - state, _, err := g.client.MergeRequestApprovals.GetApprovalState(g.repoID, int(pullRequestNumber), gitlab.WithContext(g.ctx)) + state, resp, err := g.client.MergeRequestApprovals.GetApprovalState(g.repoID, int(pullRequestNumber), gitlab.WithContext(g.ctx)) if err != nil { + if resp != nil && resp.StatusCode == 404 { + log.Error(fmt.Sprintf("GitlabDownloader: while migrating a error occurred: '%s'", err.Error())) + return []*base.Review{}, nil + } return nil, err } |