Skip to content

Forked Repositories Import Incorrect Source Data During Migration #1418

@alucia-ins

Description

@alucia-ins

Description

When migrating forked repositories from Bitbucket Server using gh bbs2gh migrate-repo, the importer pulls data from the original source repository instead of the target forked repository. This results in outdated pull requests, branches, and metadata being imported. Im using split workflow (export - get archive - import) instead of end-to-end workflow (one gh bbs2gh migrate-repo command)

Reproduction Steps

  1. Export Command:
gh bbs2gh migrate-repo \
    --bbs-server-url "$BBS_SERVER_URL" \
    --bbs-project "$BITBUCKET_PROJECT" \
    --bbs-repo "$REPO"
  1. Import command:

gh bbs2gh migrate-repo \
    --archive-path "$LATEST_ARCHIVE" \
    --github-org "$GHEC_ORG" \
    --github-repo "$REPO" \
    --bbs-server-url "$BBS_SERVER_URL" \
    --bbs-project "$BITBUCKET_PROJECT" \
    --bbs-repo "$REPO" \
    --verbose \
    --aws-bucket-name "$AWS_S3_BUCKET"

  1. Import success but imported repository contains data from the source repository it was forked from, not the actual forked repository.

Current Behavior

When migrating a forked repository (e.g., repo ID 1698), the importer pulls in outdated data (branches, pull requests, etc.) from the source repository (e.g., repo ID 1123) instead of the forked repository itself. This results in incorrect repository content and metadata being imported into GitHub.

Expected Behavior

The migration should import only the data from the specified forked repository, treating it as a standalone repository. No references or data from the original source repository should be included.

Workaround Attempted:

We manually modified the .tar archive generated by Bitbucket Server. Specifically, we edited the com.atlassian.bitbucket.server.bitbucket-git_git/repositories directory to only include the target repository (e.g., 1698), removing references to other repositories like 1123 and 522.

Before:

com.atlassian.bitbucket.server.bitbucket-git_git
└── repositories
    ├── 1123
    ├── 1698
    └── 522
Image

After:

com.atlassian.bitbucket.server.bitbucket-git_git
└── repositories
    └── 1698
Image

Environment

gh-gei version: v1.18.0
Bitbucket Server version: v8.19.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions