Skip to main content

Repo

Struct Repo 

Source
pub struct Repo { /* private fields */ }

Implementations§

Source§

impl Repo

Source

pub fn discover(from: &Path) -> Option<Self>

Discover the repository containing path (buffer path or cwd).

Source

pub fn workdir(&self) -> &Path

Source

pub fn remotes(&self) -> Vec<(String, String)>

Remotes as (name, url) pairs — libgit2 config, no spawn.

Source

pub fn head_sha(&self) -> Option<String>

HEAD’s full SHA (permalink base — branch always resolves to SHA).

Source

pub fn head_branch(&self) -> Option<String>

Current branch (short name; detached HEAD gives the sha prefix).

Source

pub fn head_content(&self, path: &Path) -> Option<String>

HEAD’s content for path, if tracked.

Source

pub fn hunks(&self, path: &Path, content: &str) -> Vec<Hunk>

Hunks between HEAD and content for path. Untracked files report a single all-Add hunk.

Source

pub fn commit_file_diff( &self, sha: &str, path: &Path, ) -> Result<FileDiff, String>

One file’s diff at sha vs its first parent, as structured hunks. The delta view’s data (0010 §1) — libgit2, no shell-out, no re-parsing our own text.

Source

pub fn stage_hunk(&self, rel: &Path, hunk: &Hunk) -> Result<(), String>

Stage one hunk. Prototype path: synthesize a single-hunk patch and git apply --cached it (shell git is the write path per 0001 §3; libgit2 owns the read hot paths). rel is repo-relative.

Auto Trait Implementations§

§

impl !Sync for Repo

§

impl Freeze for Repo

§

impl RefUnwindSafe for Repo

§

impl Send for Repo

§

impl Unpin for Repo

§

impl UnsafeUnpin for Repo

§

impl UnwindSafe for Repo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.