pub struct Git2Repo { /* private fields */ }Expand description
Concrete git repository backed by libgit2 via the git2 crate.
Construct with Git2Repo::open; then use through the GitRepo trait.
Implementations§
Trait Implementations§
Source§impl GitRepo for Git2Repo
impl GitRepo for Git2Repo
Source§fn find_reference_point(&self, commit_ish: &str) -> Result<String>
fn find_reference_point(&self, commit_ish: &str) -> Result<String>
Find the merge-base (reference point) between HEAD and a given commit-ish. Read more
Source§fn list_commits(&self, from_oid: &str, to_oid: &str) -> Result<Vec<CommitInfo>>
fn list_commits(&self, from_oid: &str, to_oid: &str) -> Result<Vec<CommitInfo>>
List commits from one commit back to another (inclusive). Read more
Source§fn commit_diff(&self, oid: &str) -> Result<CommitDiff>
fn commit_diff(&self, oid: &str) -> Result<CommitDiff>
Extract the full diff for a single commit compared to its first parent. Read more
Source§fn commit_diff_for_fragmap(&self, oid: &str) -> Result<CommitDiff>
fn commit_diff_for_fragmap(&self, oid: &str) -> Result<CommitDiff>
Extract commit diff with zero context lines, suitable for fragmap analysis. Read more
Source§fn staged_diff(&self) -> Option<CommitDiff>
fn staged_diff(&self) -> Option<CommitDiff>
Return a synthetic
CommitDiff for changes staged in the index (index vs HEAD). Read moreSource§fn unstaged_diff(&self) -> Option<CommitDiff>
fn unstaged_diff(&self) -> Option<CommitDiff>
Return a synthetic
CommitDiff for unstaged working-tree changes (workdir vs index). Read moreSource§fn split_commit_per_file(&self, commit_oid: &str, head_oid: &str) -> Result<()>
fn split_commit_per_file(&self, commit_oid: &str, head_oid: &str) -> Result<()>
Split a commit into one commit per changed file. Read more
Source§fn split_commit_per_hunk(&self, commit_oid: &str, head_oid: &str) -> Result<()>
fn split_commit_per_hunk(&self, commit_oid: &str, head_oid: &str) -> Result<()>
Split a commit into one commit per hunk. Read more
Source§fn split_commit_per_hunk_group(
&self,
commit_oid: &str,
head_oid: &str,
reference_oid: &str,
) -> Result<()>
fn split_commit_per_hunk_group( &self, commit_oid: &str, head_oid: &str, reference_oid: &str, ) -> Result<()>
Split a commit into one commit per hunk group. Read more
Source§fn count_split_per_file(&self, commit_oid: &str) -> Result<usize>
fn count_split_per_file(&self, commit_oid: &str) -> Result<usize>
Count how many commits
split_commit_per_file would produce for this commit.Source§fn count_split_per_hunk(&self, commit_oid: &str) -> Result<usize>
fn count_split_per_hunk(&self, commit_oid: &str) -> Result<usize>
Count how many commits
split_commit_per_hunk would produce for this commit.Source§fn count_split_per_hunk_group(
&self,
commit_oid: &str,
head_oid: &str,
reference_oid: &str,
) -> Result<usize>
fn count_split_per_hunk_group( &self, commit_oid: &str, head_oid: &str, reference_oid: &str, ) -> Result<usize>
Count how many fragmap groups
split_commit_per_hunk_group would produce
for this commit, given the full branch context up to head_oid from
reference_oid.Source§fn reword_commit(
&self,
commit_oid: &str,
new_message: &str,
head_oid: &str,
) -> Result<()>
fn reword_commit( &self, commit_oid: &str, new_message: &str, head_oid: &str, ) -> Result<()>
Reword the message of an existing commit. Read more
Source§fn get_config_string(&self, key: &str) -> Option<String>
fn get_config_string(&self, key: &str) -> Option<String>
Read a string value from the repository’s git configuration. Read more
Source§fn drop_commit(&self, commit_oid: &str, head_oid: &str) -> Result<RebaseOutcome>
fn drop_commit(&self, commit_oid: &str, head_oid: &str) -> Result<RebaseOutcome>
Drop a commit from the branch by cherry-picking its descendants onto
its parent. Read more
Source§fn rebase_continue(&self, state: &ConflictState) -> Result<RebaseOutcome>
fn rebase_continue(&self, state: &ConflictState) -> Result<RebaseOutcome>
Resume a conflicted rebase after the user has resolved conflicts. Read more
Source§fn rebase_abort(&self, state: &ConflictState) -> Result<()>
fn rebase_abort(&self, state: &ConflictState) -> Result<()>
Abort a conflicted rebase and restore the branch to its original state. Read more
Source§fn workdir(&self) -> Option<PathBuf>
fn workdir(&self) -> Option<PathBuf>
Return the path of the repository’s working directory, if any. Read more
Source§fn read_index_stage(&self, path: &str, stage: i32) -> Result<Option<Vec<u8>>>
fn read_index_stage(&self, path: &str, stage: i32) -> Result<Option<Vec<u8>>>
Read the raw blob content of a specific index stage for a conflicted path. Read more
Source§fn read_conflicting_files(&self) -> Vec<String>
fn read_conflicting_files(&self) -> Vec<String>
Return the list of paths that currently have conflict markers in the index
(entries with stage > 0), sorted alphabetically and deduplicated.
Source§fn move_commit(
&self,
commit_oid: &str,
insert_after_oid: &str,
head_oid: &str,
) -> Result<RebaseOutcome>
fn move_commit( &self, commit_oid: &str, insert_after_oid: &str, head_oid: &str, ) -> Result<RebaseOutcome>
Move a commit to a different position on the branch. Read more
Source§fn squash_commits(
&self,
source_oid: &str,
target_oid: &str,
message: &str,
head_oid: &str,
) -> Result<RebaseOutcome>
fn squash_commits( &self, source_oid: &str, target_oid: &str, message: &str, head_oid: &str, ) -> Result<RebaseOutcome>
Squash two commits into one. Read more
Source§fn stage_file(&self, path: &str) -> Result<()>
fn stage_file(&self, path: &str) -> Result<()>
Stage a working-tree file, clearing any conflict entries for that path. Read more
Source§fn auto_stage_resolved_conflicts(&self, files: &[String]) -> Result<()>
fn auto_stage_resolved_conflicts(&self, files: &[String]) -> Result<()>
Auto-stage conflicting files whose working-tree content no longer
contains conflict markers. Read more
Source§fn default_branch(&self) -> Option<String>
fn default_branch(&self) -> Option<String>
Return the name of the repository’s default upstream branch. Read more
Source§fn squash_try_combine(
&self,
source_oid: &str,
target_oid: &str,
combined_message: &str,
is_fixup: bool,
head_oid: &str,
) -> Result<Option<ConflictState>>
fn squash_try_combine( &self, source_oid: &str, target_oid: &str, combined_message: &str, is_fixup: bool, head_oid: &str, ) -> Result<Option<ConflictState>>
Test whether combining source onto target produces a conflict. Read more
Source§fn squash_finalize(
&self,
ctx: &SquashContext,
message: &str,
original_branch_oid: &str,
) -> Result<RebaseOutcome>
fn squash_finalize( &self, ctx: &SquashContext, message: &str, original_branch_oid: &str, ) -> Result<RebaseOutcome>
Finalize a squash after the user resolved a squash-time tree conflict. Read more
Auto Trait Implementations§
impl Freeze for Git2Repo
impl RefUnwindSafe for Git2Repo
impl Send for Git2Repo
impl !Sync for Git2Repo
impl Unpin for Git2Repo
impl UnsafeUnpin for Git2Repo
impl UnwindSafe for Git2Repo
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> 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