pub struct Repo { /* private fields */ }Expand description
Remote Git repository.
§Example
use thin_fetch::{HashKind, Repo};
let url = "https://git.ddd.rip/ptrcnull/thin-fetch.git";
let repo = Repo::new(url, HashKind::Sha1);
// perform an operation on the repo:
let refs = repo.list_refs();Implementations§
Source§impl Repo
impl Repo
Sourcepub fn fetch_blobs(
&self,
oid: &str,
blobs: Vec<String>,
) -> Result<Vec<Object>, Error>
pub fn fetch_blobs( &self, oid: &str, blobs: Vec<String>, ) -> Result<Vec<Object>, Error>
Fetch listed blobs for a given commit.
§Errors
Returns an error if the fetch command or parsing the response fails.
Sourcepub fn fetch_tree(
&self,
have: &str,
want: &str,
blobs: bool,
) -> Result<Vec<Object>, Error>
pub fn fetch_tree( &self, have: &str, want: &str, blobs: bool, ) -> Result<Vec<Object>, Error>
Fetch commits between have and want, optionally including blobs.
§Errors
Returns an error if the fetch command or parsing the response fails.
Source§impl Repo
impl Repo
Source§impl Repo
impl Repo
Sourcepub fn new_discover<S: Into<String>>(url: S) -> Result<Self, Error>
pub fn new_discover<S: Into<String>>(url: S) -> Result<Self, Error>
Create new repo with a given URL, discovering the hash kind from the server.
§Errors
Returns an error when the remote repo does not support v2 protocol,
or does not send object-format in capabilities.
Sourcepub fn new<S: Into<String>>(url: S, hash_kind: HashKind) -> Self
pub fn new<S: Into<String>>(url: S, hash_kind: HashKind) -> Self
Create new repo with a given URL and hash kind.
Assumes that the remote repo does support v2 protocol.
Sourcepub fn stream<C: Into<Parcel>>(
&self,
cmd: C,
) -> Result<ParcelDecoder<BodyReader<'static>>, Error>
pub fn stream<C: Into<Parcel>>( &self, cmd: C, ) -> Result<ParcelDecoder<BodyReader<'static>>, Error>
Sourcepub fn list_refs_prefix<P: Into<String>>(
&self,
prefix: P,
) -> Result<Vec<Reference>, Error>
pub fn list_refs_prefix<P: Into<String>>( &self, prefix: P, ) -> Result<Vec<Reference>, Error>
List all remote references, filtering by a given prefix.
§Errors
Returns an error when the command fails to execute.
pub fn objects(&self) -> impl Iterator<Item = &Object>
Auto Trait Implementations§
impl Freeze for Repo
impl RefUnwindSafe for Repo
impl Send for Repo
impl Sync for Repo
impl Unpin for Repo
impl UnsafeUnpin for Repo
impl UnwindSafe for Repo
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
Mutably borrows from an owned value. Read more