Skip to main content

validate_git_url

Function validate_git_url 

Source
pub fn validate_git_url(url: &str) -> Result<(), PackageError>
Expand description

Validate a Git remote URL’s scheme and basic shape (no network access).

Accepted forms:

  • SCP-like git@host:org/repo (no scheme),
  • URL forms with scheme https, http, git, or ssh,
  • Local repository paths (an absolute path on the current platform, e.g. /abs/path on Unix or C:\abs\path on Windows, plus ./rel, ../rel, ~/path), which git clone accepts directly and are used by offline/hermetic tests.

The URL/reference must be non-empty. A bare host with no scheme and no path separator (e.g. github.com/org/repo without a scheme) is rejected as an invalid URL. This is a syntax/shape check only — no network connection is made.