NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.71k stars 221 forks source link

improve handling of user@host:repo.git and git://host/repo parsing #1266

Closed franklouwers closed 3 months ago

franklouwers commented 3 months ago

Description

Per the Git Book (https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols), the protocols can be the following:

The git@server:project.git shorthand is handled by the lib/git/remote.lua parser as if it were a shorthand for the Git protocol, but is in fact a shorthand for the SSH protocol (see the page from the Git Book linked above).

While only used for parsing and not for communicating, this leads for a few issues, especially for self-hosted GitLab installs where you can have urls like "git@gitlab.priv:group/project/repo.git" which weren't correctly handled (noticed as a result of https://github.com/NeogitOrg/neogit/issues/1259#issuecomment-2079268027)

Neovim version

NVIM v0.10.0-dev-2883+g2c5fd3f96-Homebrew Build type: Release LuaJIT 2.1.1710088188

Operating system and version

MacOS 14.4.1

Steps to reproduce

Parse url "git@gitlab.priv:group/project/repo.git". Parse url "ssh://git@gitlab.priv/group/project/repo.git"

Expected behavior

Both should parse correctly and identically. repo should be repo.git, owner should be group/project

Actual behavior

Both parse differently.

Minimal config