Skip to content

Incompatibility in gitbucket migration #30316

Closed
@jam7

Description

@jam7

Description

Thank you for development. Thank you for implementing migration from gitbucket (#16767). It helps me a lot. However, it doesn't work if a gitbucket repository has many issues or PRs. I inspect it and find the source of problem, so I'm posting this bug report.

While I'm checking the log of migration, I notice there are several logs like Request get issues 49/1, but in fact get 39. This is the source of gitbucket migration problem caused by following incompatibility

  • Gitea treat it, fewer issues than perPage issues, as a mark of end of information.
  • Gitbucket doesn't return full 49 issues if there are missing issues in the situation like #1 issue, #2 PR, #3 issue.

Easiest way to patch this is to change the migration mechanism. For example, it is possible to change the mechanism to perform migration until an empty array of issues is returned from GetIssue() routine.

+++ b/services/migrations/migrate.go
@@ -331,6 +331,10 @@ func migrateRepository(ctx context.Context, doer *user_model.User, downloader ba

                for i := 1; ; i++ {
                        issues, isEnd, err := downloader.GetIssues(i, issueBatchSize)
+                       isEnd = false
+                       if len(issues) == 0 {
+                               break;
+                       }
                        if err != nil {
                                if !base.IsErrNotSupported(err) {
                                        return err

This works fine while the number of missing issues is small. If there are many missing numbers more than 98 in issues like #1 issue, #2 PR, ..., #99 PR, #100 issue, this doesn't work well. I have no idea how to improve the mechanism, so I'm just posting this bug report.

Gitea Version

1.21.10

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Gitea in docker, gitea/gitea:1.21.10.

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/repo-migrationMigrate repos from other platforms to Gitea, or from Gitea to themtype/bugtype/upstreamThis is an issue in one of Gitea's dependencies and should be reported there

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions