pub struct GitFetcher { /* private fields */ }Expand description
Fetcher implementation backed by libgit2.
Implementations§
Source§impl GitFetcher
impl GitFetcher
Sourcepub fn new(cache_root: PathBuf) -> Self
pub fn new(cache_root: PathBuf) -> Self
Create a new GitFetcher that stores clones under cache_root.
List remote tag names by ls-remote (no clone).
Connects to url in fetch direction, enumerates refs/tags/*, strips
the refs/tags/ prefix and the ^{} peeled-tag suffix when present,
and returns a de-duplicated Vec<String> in arbitrary order.
Sourcepub fn ls_remote_refs(
&self,
url: &str,
) -> Result<Vec<(String, String)>, PkgError>
pub fn ls_remote_refs( &self, url: &str, ) -> Result<Vec<(String, String)>, PkgError>
ls-remote: every advertised ref as (name, oid hex), e.g.
("refs/tags/v1.0.0^{}", "abc…") / ("refs/heads/main", "…") /
("HEAD", "…"). Transfers ref names only, no objects.
Sourcepub fn resolve_sha(
&self,
dep: &Dep,
) -> Result<Option<(String, Option<String>)>, PkgError>
pub fn resolve_sha( &self, dep: &Dep, ) -> Result<Option<(String, Option<String>)>, PkgError>
Resolve dep to its commit without cloning, when the pin allows
it: a full 40-hex rev needs no network, tag / branch / no pin
cost one ls-remote. Returns None for a short / symbolic rev
or a ref the remote does not advertise (a real fetch then produces
the error). Used by install to decide whether a patch_dir is
still based on the pinned commit before touching the cache.
§Errors
PkgError::Validation for a malformed URL, PkgError::GitFetch
when the remote cannot be listed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitFetcher
impl RefUnwindSafe for GitFetcher
impl Send for GitFetcher
impl Sync for GitFetcher
impl Unpin for GitFetcher
impl UnsafeUnpin for GitFetcher
impl UnwindSafe for GitFetcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more