GitHub importer errors for renamed / redirected projects

Summary

On GitHub, you can rename projects and the old URLs are redirected on a best-effort basis. I had already imported the project to GitLab (mirrored automatically) when I renamed the GitHub project. GitLab updates the repository name in some but not all places, so I didn't notice that it was already imported. On the GitHub importer page, it listed the project both under the old name (as imported) and the new name (as not imported).

When I tried to import the renamed project, it errored with status code 422 and a generic error message. DevTools revealed that the failing HTTP request said "The change you requested was rejected".

Upon realizing that the project was already imported via the old name (and URL), I deleted that repository on GitLab. From there, the import of the project under the new name worked as expected.

Steps to reproduce

  • Create a project on GitHub
  • Import the project to GitLab (which sets set up mirroring)
  • Rename the project on GitHub
  • Try to import the project under the new name to GitLab

Example Project

Edit: The bug can only be reproduced when the first import was performed with an old importer. I don't know the exact version (it was about a year ago).

What is the current bug behavior?

  • The importer doesn't recognize the name conflict
  • The importer errors with status code 422 and a generic error message.

What is the expected correct behavior?

  • The importer recognizes the name conflict and informs the user.
  • Ideally, it provides an option to update the old repository (the new name and URL).
  • If that's not feasible, it suggests to remove the old repository and re-import the new repository.

Output of checks

This bug happens on GitLab.com

Possible fixes

I think the name conflict isn't recognized because the name of the repository is in multiple places. The importer normally recognizes already imported projects but the old repository uses the old URL. GitLab already recognizes the redirection to the new URL and updates the name but not the URL(s).

These possible fixes come to mind:

  • The importer explicitly checks for redirects
  • GitLab implements "aliases" solidly
  • When a redirect is detected, the user is asked to update name, URLs and other references
  • When a redirect is detected, automatically update at least the mirrored URL
  • When a redirect is detected, automatically rename the GitLab repository as accordingly
Edited Jun 15, 2018 by Robin Richtsfeld
Assignee Loading
Time tracking Loading