pub struct GitRepo { /* private fields */ }Expand description
A handle to a local Git repository, identified by its working directory path.
GitRepo does not hold a git2::Repository directly because Repository
is !Sync while Operation requires
Send + Sync. Instead, each operation re-opens the repository inside
spawn_blocking.
§Examples
use ironflow_ops_git::GitRepo;
let repo = GitRepo::open("/path/to/repo")?;
assert!(repo.path().exists());Implementations§
Source§impl GitRepo
impl GitRepo
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, OperationError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, OperationError>
Open an existing repository at the given path.
The path should point to the working directory (not .git/).
§Errors
Returns OperationError::External if the path is not a valid
Git repository.
§Examples
use ironflow_ops_git::GitRepo;
let repo = GitRepo::open("/path/to/repo")?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitRepo
impl RefUnwindSafe for GitRepo
impl Send for GitRepo
impl Sync for GitRepo
impl Unpin for GitRepo
impl UnsafeUnpin for GitRepo
impl UnwindSafe for GitRepo
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