Show warning if no .git in the URL when importing Repo by URL
Problem to solve
Per this comment, enforcing .git in the URL when importing impacted a customer in internal ticket who can no longer use Import from URL feature to import projects from xp-dev.com. It seems like there are platforms that don't necessarily expose URLs ending with .git.
Steps to reproduce
- Create an account at xp-dev.com (they have 30 days trial with no credit card information) - > Create a test project
- Try importing that project to GitLab using Import by URL feature.
- Unable to find a way to get a URL ending with
.git
Proposed solution
A 3-step solution was proposed in this comment:
- Revert current MR (#331803 (closed))
- Switch from "error message" to "warning" (this issue)
- Switch from "dummy error message" to making real backend-based validation "if the supplied URL feels like GIT url" (#331641 (closed)).
This issue implements step 2:
When the URL doesn't end with .git
, show a warning, similar to the original solution. To do that, we should add a validation to the URL field that would fail unless the URL ends in .git
upon clicking on the Create project
button. If the validation fails, a warning is displayed, similar to the original solution. However, the warning would be non-blocking and the user would be able to continue with the next action.
This is the desired text of the warning:
A repository URL usually ends in a .git suffix, although this is not required. Double check to make sure your repository URL is correct.