pub struct GitUrl(/* private fields */);Expand description
A URL reference to a Git repository.
Store the Git-specific fields out of line so ordinary registry and path requirements do not reserve space for both URLs, a Git reference, and a resolved commit.
Implementations§
Source§impl GitUrl
impl GitUrl
Sourcepub fn from_commit(
url: SafeUrl,
reference: GitReference,
precise: GitOid,
lfs: GitLfs,
) -> Result<Self, GitUrlParseError>
pub fn from_commit( url: SafeUrl, reference: GitReference, precise: GitOid, lfs: GitLfs, ) -> Result<Self, GitUrlParseError>
Create a new GitUrl from a repository URL and a precise commit.
Sourcepub fn from_fields(
url: SafeUrl,
reference: GitReference,
precise: Option<GitOid>,
lfs: GitLfs,
) -> Result<Self, GitUrlParseError>
pub fn from_fields( url: SafeUrl, reference: GitReference, precise: Option<GitOid>, lfs: GitLfs, ) -> Result<Self, GitUrlParseError>
Create a new GitUrl from a repository URL and a precise commit, if known.
Sourcepub fn with_precise(self, precise: GitOid) -> Result<Self, GitUrlParseError>
pub fn with_precise(self, precise: GitOid) -> Result<Self, GitUrlParseError>
Set the precise GitOid to use for this Git URL.
Sourcepub fn with_reference(self, reference: GitReference) -> Self
pub fn with_reference(self, reference: GitReference) -> Self
Set the GitReference to use for this Git URL, clearing any resolved commit if it changes.
Sourcepub fn repository(&self) -> &RepositoryUrl
pub fn repository(&self) -> &RepositoryUrl
Return the canonical repository identity for this Git URL.
Sourcepub fn reference(&self) -> &GitReference
pub fn reference(&self) -> &GitReference
Return the reference to the commit to use, which could be a branch, tag or revision.
Sourcepub fn precise(&self) -> Option<GitOid>
pub fn precise(&self) -> Option<GitOid>
Return the precise commit, whether requested directly or resolved from a named reference.
Sourcepub fn resolved_commit(&self) -> Option<GitOid>
pub fn resolved_commit(&self) -> Option<GitOid>
Return the commit obtained by resolving a reference, if known.
Returns None when the reference is itself a full commit.