pub struct Repo { /* private fields */ }Implementations§
Source§impl Repo
impl Repo
Sourcepub fn discover(from: &Path) -> Option<Self>
pub fn discover(from: &Path) -> Option<Self>
Discover the repository containing path (buffer path or cwd).
pub fn workdir(&self) -> &Path
Sourcepub fn remotes(&self) -> Vec<(String, String)>
pub fn remotes(&self) -> Vec<(String, String)>
Remotes as (name, url) pairs — libgit2 config, no spawn.
Sourcepub fn head_sha(&self) -> Option<String>
pub fn head_sha(&self) -> Option<String>
HEAD’s full SHA (permalink base — branch always resolves to SHA).
Sourcepub fn head_branch(&self) -> Option<String>
pub fn head_branch(&self) -> Option<String>
Current branch (short name; detached HEAD gives the sha prefix).
Sourcepub fn head_content(&self, path: &Path) -> Option<String>
pub fn head_content(&self, path: &Path) -> Option<String>
HEAD’s content for path, if tracked.
Sourcepub fn index_content(&self, path: &Path) -> Option<String>
pub fn index_content(&self, path: &Path) -> Option<String>
The index’s content for path (the staged version), if any.
Sourcepub fn staged_hunks(&self, path: &Path) -> Vec<Hunk>
pub fn staged_hunks(&self, path: &Path) -> Vec<Hunk>
Hunks between HEAD and the index — the STAGED set (0014 wave 4: the four states are HEAD → index → worktree → live document, and every command names its edge).
Sourcepub fn unstaged_hunks(&self, path: &Path, content: &str) -> Vec<Hunk>
pub fn unstaged_hunks(&self, path: &Path, content: &str) -> Vec<Hunk>
Hunks between the index and content — the UNSTAGED set (what
the gutter shows while you edit). When nothing is staged this
equals HEAD↔content, matching pre-0.5 behavior.
Sourcepub fn unstage_hunk(&self, rel: &Path, hunk: &Hunk) -> Result<(), String>
pub fn unstage_hunk(&self, rel: &Path, hunk: &Hunk) -> Result<(), String>
Unstage one hunk: the index→HEAD edge, git apply --cached -R.
Sourcepub fn hunks(&self, path: &Path, content: &str) -> Vec<Hunk>
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.