source-controller
source-controller copied to clipboard
Improve error message for invalid `GitRepository` URL formats
GitRepository
objects require the SSH URL to be in a specific format, as per documentation:
Unlike using git, the shorter scp-like syntax is not supported for SSH addresses (e.g. [email protected]:repository.git). Instead, the valid URL format is ssh://[email protected]:22/repository.git.
However, when users use the unsupported format they are presented with non-user friendly error messages such as:
unable to clone 'ssh://[email protected]/org/repo', error: parse "[email protected]:org/repo.git": first path segment in URL cannot contain colon
As part of improving the user friendliness of the error message. The same validation should be used, and the same error returned, for all Git implementations (go-git
or libgit2
).