pub struct Git { /* private fields */ }Expand description
Runs git with a fixed environment. Every call names its directory and can never wait for a password.
Implementations§
Source§impl Git
impl Git
pub fn new() -> Git
Sourcepub fn main_checkout(&self, cwd: &Path) -> Result<PathBuf, GitError>
pub fn main_checkout(&self, cwd: &Path) -> Result<PathBuf, GitError>
The repository’s main checkout, from it or from any linked worktree.
Sourcepub fn workspace(&self, cwd: &Path) -> Result<(PathBuf, bool), GitError>
pub fn workspace(&self, cwd: &Path) -> Result<(PathBuf, bool), GitError>
Returns (root, is_git). Outside a git repository, falls back to cwd
(is_git = false) so plain project or document folders work without git.
Sourcepub fn preflight(&self, main: &Path) -> Result<(), GitError>
pub fn preflight(&self, main: &Path) -> Result<(), GitError>
A run needs a first commit to branch from and an identity to commit with.
pub fn is_dirty(&self, main: &Path) -> Result<bool, GitError>
Sourcepub fn ensure_excluded(&self, main: &Path) -> Result<(), GitError>
pub fn ensure_excluded(&self, main: &Path) -> Result<(), GitError>
Adds .onerig/ to the exclude file all worktrees share, once.
Sourcepub fn create_run_worktree(
&self,
main: &Path,
worktree: &Path,
branch: &str,
base: &str,
) -> Result<(), GitError>
pub fn create_run_worktree( &self, main: &Path, worktree: &Path, branch: &str, base: &str, ) -> Result<(), GitError>
base is the ref the new branch starts from, such as HEAD or an
earlier run’s branch.
pub fn head(&self, worktree: &Path) -> Result<String, GitError>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Git
impl Freeze for Git
impl Move for Git
impl RefUnwindSafe for Git
impl Send for Gitwhere
RawVecInner: Send,
impl Sync for Gitwhere
RawVecInner: Sync,
impl Unpin for Git
impl UnsafeUnpin for Git
impl UnwindSafe for Gitwhere
RawVecInner: UnwindSafe,
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