Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gitlab to Gitea] Pull requests import is okay, but pull/heads points to invalid objects leads to no new branch or PR #15155

Closed
2 of 6 tasks
99rgosse opened this issue Mar 25, 2021 · 9 comments · Fixed by #17076
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug

Comments

@99rgosse
Copy link
Contributor

99rgosse commented Mar 25, 2021

Hello everyone
I began migrating repositories from my self hosted Gitlab, and every features work great, thanks !

The only downside is when I migrate the Pull Requests, I can access commits only on open PR, the closed Pull Requests don’t have any commits within (see screenshot)
Also when trying to access files, I got an error 500.
If the PR is still open, everything work as intended.

Please let me know if there is anything I can do for help, and thanks for the great work !

  • Gitea version (or commit ref): tried on Gitea 1.13.4 and 1.15.0+Dev

  • Git version:

  • Gitlab Version : EE 13.9.4 and CE 12.8.0

  • Operating system:
    Ubuntu-bionic 18.04.5 LTS under Vagrant+VirtualBox

  • Database (use [x]):

    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:

  • Log gist:

    • when clicking on page:
      routers/repo/pull.go:659:ViewPullFiles() [E] GetCommit: object does not exist [id: , rel_path: ]

    • when importing:

  • error: refs/pull/1488/head does not point to a valid object!

  • error: refs/pull/1507/head does not point to a valid object!

  • 2021/03/25 14:36:24 ...es/pull/temp_repo.go:104:createTemporaryRepo() [E] Unable to fetch origin base branch [gitrepo/repo3:repo4/master -> base, original_base in /data/gitea/tmp/local-repo/pull.git082213367]: exit status 1: error: refs/pull/1538/head does not point to a valid object! error: refs/pull/1544/head does not point to a valid object! error: refs/pull/1545/head does not point to a valid object! error: refs/pull/1546/head does not point to a valid object! error: refs/pull/1551/head does not point to a valid object! error: refs/pull/1560/head does not point to a valid object! fatal: bad object .alternate error: /data/git/repositories/gitrepo/repo3.git did not send all necessary objects

Description

Gitea service is directly accessible from within my intranet, linked to port 3000.
When trying a migration from gitlab to gitea, the PR are imported but of course deleted branches can't
14:35:59 Started GET /user/task/11?_csrf=

Screenshots

PR

@techknowlogick techknowlogick added the topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them label Mar 25, 2021
@99rgosse
Copy link
Contributor Author

99rgosse commented Mar 26, 2021

Added a link to try.gitea.io https://try.gitea.io/99rgosse/gitlab_to_gitea/pulls/1

@safag05
Copy link

safag05 commented May 4, 2021

Hello- Any updates on this issue? I have a similar issue. I have imported a repo from Gitlab to Gitea version 1.13.7 not all but some closed merge request in Gitlab does not get transferred over to Gitea. While trying to create a new branch from master I get the head does not point to a valid object! error for some closed merge requests.

@99rgosse
Copy link
Contributor Author

99rgosse commented May 4, 2021

While trying to create a new branch from master I get the head does not point to a valid object! error for some closed merge requests.

As the noob I am, I began looking at the migration commands, and I think this is manageable with some "tricks and extra commands", like importing the lonely commits and attaching them to branches made only for the occasion.
Thus this will need time !

@juev
Copy link

juev commented Jul 15, 2021

On last version gitea 1.14.4 we have this issue on importing repositories from Gitlab with pull requests.

If we using import without pull requests, it fine, all repositories worked as expected. But if we enable import Pull Request, repository is unuseble, creating new branch ended with errors.

@99rgosse
Copy link
Contributor Author

In fact the import process cannot invent branches and commits that are not here anymore.

To do this, Gitea needs to know what must be displayed when you successfully merge, and when you make an import maybe replay some parts needed.

@99rgosse
Copy link
Contributor Author

image

What is the correct way to handle this situation ? I solved this by pointing the wrong refs to the oldest commit accessible on master, as we merge by fast forward the most of time.
But maybe there is a better solution ?

@99rgosse
Copy link
Contributor Author

Notabene : the Error 500 is not anymore on the latest gitea versions...

@sashakram
Copy link

With "gitea/gitea:1.15.2" I got the same issue.
After migration from Gitlab not possible create a new PR in Gitea.

`2021/09/09 23:19:28 ...ers/web/repo/pull.go:1113:CompareAndPullRequestPost() [E] NewPullRequest: Unable to fetch origin base branch [group1/repo1:master -> base, original_base in tmpBasePath]: exit status 1

    error: refs/pull/100/head does not point to a valid object!
    error: refs/pull/104/head does not point to a valid object!
    .........
    error: refs/pull/98/head does not point to a valid object!
    fatal: bad object .alternate
    error: /data/git/repositories/group1/repo1.git did not send all necessary objects

2021/09/09 23:19:28 Completed POST /group1/repo1/compare/master...feature/test1 500 Internal Server Error in 141.856947ms`

@99rgosse
Copy link
Contributor Author

If you remove the heads (or as I did, point them to old commit), it will work again, the PR will be accessible in Gitea (but the calculation still won't work for these old ones)

@99rgosse 99rgosse changed the title [Gitlab to Gitea] Pull requests import is okay, but no commit within, files leads to Error 500 [Gitlab to Gitea] Pull requests import is okay, but pull/heads points to invalid objects leads to no new branch or PR Sep 10, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants