pub struct MemoryGitRepo { /* private fields */ }Implementations§
Source§impl MemoryGitRepo
impl MemoryGitRepo
Sourcepub fn open_or_init(
root: &Path,
author_name: impl Into<String>,
author_email: impl Into<String>,
) -> Result<Self>
pub fn open_or_init( root: &Path, author_name: impl Into<String>, author_email: impl Into<String>, ) -> Result<Self>
Open an existing .git at root, or init a fresh repo plus
.gitignore / .gitattributes + an initial commit.
Sourcepub fn with_guard(self, guard: SecretGuard) -> Self
pub fn with_guard(self, guard: SecretGuard) -> Self
Attach a secret guard for scanning staged content before commit. On Block, the commit is aborted.
Sourcepub fn with_mutation_hook(
self,
hook: Arc<dyn MemoryMutationHook>,
agent_id: impl Into<String>,
tenant: impl Into<String>,
) -> Self
pub fn with_mutation_hook( self, hook: Arc<dyn MemoryMutationHook>, agent_id: impl Into<String>, tenant: impl Into<String>, ) -> Self
Attach a mutation observer + the
(agent_id, tenant) pair the event carries. The hook is
fired post-successful-commit via tokio::spawn so it never
blocks the libgit2 thread.
pub fn root(&self) -> &Path
Sourcepub fn commit_all(&self, subject: &str, body: &str) -> Result<Option<Oid>>
pub fn commit_all(&self, subject: &str, body: &str) -> Result<Option<Oid>>
Stage every non-ignored change (skipping blobs > MAX_COMMIT_FILE_BYTES)
and commit. Returns Ok(None) if the worktree was clean.
Auto Trait Implementations§
impl !Freeze for MemoryGitRepo
impl !RefUnwindSafe for MemoryGitRepo
impl !UnwindSafe for MemoryGitRepo
impl Send for MemoryGitRepo
impl Sync for MemoryGitRepo
impl Unpin for MemoryGitRepo
impl UnsafeUnpin for MemoryGitRepo
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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