Fix RemoteMirror self-reference validation for hostname case differences

What does this MR do and why?

Fixes RemoteMirror self-reference validation when repository URLs differ only by hostname capitalization. Hostnames are compared case-insensitively while repository path casing remains unchanged.

How to test

bundle exec rspec spec/models/remote_mirror_spec.rb:160
bundle exec rspec spec/models/remote_mirror_spec.rb:193
bundle exec rspec spec/models/remote_mirror_spec.rb:128
bundle exec rspec spec/models/remote_mirror_spec.rb
bundle exec rubocop app/models/remote_mirror.rb spec/models/remote_mirror_spec.rb

Before

A self-referencing remote URL whose hostname differed only by capitalization passed validation.

After

The same URL is rejected with:

You cannot mirror a repository to itself.

Implementation notes

  • Parses the sanitized URL with Addressable::URI and lowercases only the host.
  • Preserves path casing, username, port, query, credential handling, .git/slash handling, and SCP-style SSH conversion.
  • Adds coverage for HTTP and SCP-style SSH URLs.

Risk

Small and localized, but non-zero: URL normalization behavior is involved.

Closes #628295 (closed)

AI assistance

AI tooling was used to assist with investigation and drafting. The contributor independently reviewed the implementation, reproduced the bug locally, verified the regression test and fix, and takes responsibility for the submitted changes.

Edited by Whale Tech

Merge request reports

Loading
Loading