pub struct Repository { /* private fields */ }
Expand description
A git repository (a reference to a local path containing a .git directory, or a bare some_repository.git directory)
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn from_bare_repository(dir: impl Into<PathBuf>) -> Result<Self>
pub fn from_bare_repository(dir: impl Into<PathBuf>) -> Result<Self>
§Examples
let repository = clgit::Repository::from_bare_repository(".git").unwrap();
Sourcepub fn from_regular_repository(dir: impl AsRef<Path>) -> Result<Self>
pub fn from_regular_repository(dir: impl AsRef<Path>) -> Result<Self>
§Examples
let repository = clgit::Repository::from_regular_repository(".").unwrap();
Sourcepub fn from_path(dir: impl AsRef<Path>) -> Result<Self>
pub fn from_path(dir: impl AsRef<Path>) -> Result<Self>
§Examples
let repository = clgit::Repository::from_path(".").unwrap();
let repository = clgit::Repository::from_path(".git").unwrap();
Sourcepub fn local_branches(&self) -> Result<impl Iterator<Item = Result<Branch>>>
pub fn local_branches(&self) -> Result<impl Iterator<Item = Result<Branch>>>
§Examples
for branch in repository.local_branches()? {
let branch : clgit::Branch = branch?;
println!("{}", branch.name().to_string_lossy());
let _ = branch.commit();
}
Sourcepub fn remote_branches(&self) -> Result<impl Iterator<Item = Result<Branch>>>
pub fn remote_branches(&self) -> Result<impl Iterator<Item = Result<Branch>>>
§Examples
for branch in repository.remote_branches()? {
let branch : clgit::Branch = branch?;
println!("{}", branch.name().to_string_lossy());
let _ = branch.commit();
}
Sourcepub fn cat_file_size(&self, hash: &Hash) -> Result<u64>
pub fn cat_file_size(&self, hash: &Hash) -> Result<u64>
Run/parse git cat-file -s [hash]
Sourcepub fn cat_file_type(&self, hash: &Hash) -> Result<FileType>
pub fn cat_file_type(&self, hash: &Hash) -> Result<FileType>
Run/parse git cat-file -t [hash]
Sourcepub fn cat_file_commit(&self, hash: &Hash) -> Result<impl Read>
pub fn cat_file_commit(&self, hash: &Hash) -> Result<impl Read>
Run/parse git cat-file commit [hash]
Sourcepub fn cat_file_tree(&self, hash: &Hash) -> Result<impl Read>
pub fn cat_file_tree(&self, hash: &Hash) -> Result<impl Read>
Run/parse git cat-file tree [hash]
Sourcepub fn cat_file_blob(&self, hash: &Hash) -> Result<impl Read>
pub fn cat_file_blob(&self, hash: &Hash) -> Result<impl Read>
Run/parse git cat-file blob [hash]
Trait Implementations§
Source§impl Clone for Repository
impl Clone for Repository
Source§fn clone(&self) -> Repository
fn clone(&self) -> Repository
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Repository
impl Debug for Repository
Source§impl From<Repository> for RepositoryCache
impl From<Repository> for RepositoryCache
Source§fn from(repository: Repository) -> Self
fn from(repository: Repository) -> Self
Converts to this type from the input type.
Source§fn try_into_src(self) -> Result<Arc<RepositoryCache>>
fn try_into_src(self) -> Result<Arc<RepositoryCache>>
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl Sync for Repository
impl Unpin for Repository
impl UnwindSafe for Repository
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