Skip to main content

Git

Struct Git 

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

Implementations§

Source§

impl Git

Source

pub fn new(cwd: impl Into<PathBuf>) -> Self

Source

pub fn is_installed(&self) -> bool

Source

pub fn is_inside_work_tree(&self) -> bool

Source

pub fn repo_root(&self) -> Option<PathBuf>

Source

pub fn commit(&self, message: &str, allow_empty: bool) -> Result<(), Error>

Source

pub fn list_commits( &self, from: Option<&str>, to: &str, ) -> Result<Vec<CommitSummary>, Error>

Source

pub fn latest_tag(&self) -> Result<Option<String>, Error>

Source

pub fn tag_date(&self, tag: &str) -> Result<Option<String>, Error>

Source

pub fn create_tag(&self, name: &str, message: &str) -> Result<(), Error>

Source

pub fn create_signed_tag(&self, name: &str, message: &str) -> Result<(), Error>

Source

pub fn create_branch(&self, name: &str, from: Option<&str>) -> Result<(), Error>

Source

pub fn checkout_branch(&self, name: &str) -> Result<(), Error>

Source

pub fn list_branches(&self) -> Result<Vec<String>, Error>

Source

pub fn rename_branch(&self, old_name: &str, new_name: &str) -> Result<(), Error>

Source

pub fn delete_branch(&self, name: &str, force: bool) -> Result<(), Error>

Source

pub fn fetch(&self, remote: &str) -> Result<(), Error>

Source

pub fn rebase(&self, onto: &str) -> Result<(), Error>

Source

pub fn merge(&self, branch: &str) -> Result<(), Error>

Source

pub fn prune_remote_tracking(&self, remote: &str) -> Result<(), Error>

Source

pub fn is_branch_merged(&self, name: &str) -> Result<bool, Error>

Source

pub fn push_branch(&self, remote: &str, branch: &str) -> Result<(), Error>

Source

pub fn push_tag(&self, remote: &str, tag: &str) -> Result<(), Error>

Source

pub fn stage_path(&self, path: &str) -> Result<(), Error>

Source

pub fn unstage_path(&self, path: &str) -> Result<(), Error>

Source

pub fn list_changes(&self) -> Result<Vec<Change>, Error>

Source

pub fn list_tags_sorted(&self) -> Result<Vec<String>, Error>

Source

pub fn latest_tag_ancestor_of(&self, rev: &str) -> Result<Option<String>, Error>

Source

pub fn commits_by_tag(&self, to: &str) -> Result<Vec<TaggedCommits>, Error>

Returns commits grouped by tag boundary, ordered newest-first.

Each entry contains the tag name (or "Unreleased" for the leading segment) and the commits that fall in that range. The ranges are computed as half-open intervals (prev_tag, tag] so every commit appears in exactly one entry.

to is the tip of the walk (usually "HEAD").

Source

pub fn stage_all(&self) -> Result<(), Error>

Source

pub fn unstage_all(&self) -> Result<(), Error>

Source

pub fn stage_paths(&self, paths: &[String]) -> Result<(), Error>

Source

pub fn unstage_paths(&self, paths: &[String]) -> Result<(), Error>

Source

pub fn diff_unstaged(&self, path: &str) -> Result<Option<String>, Error>

Source

pub fn show_unstaged_diff(&self, path: &str) -> Result<String, Error>

Source

pub fn github_web_url(&self) -> Result<Option<String>, Error>

Source

pub fn current_branch(&self) -> Result<String, Error>

Trait Implementations§

Source§

impl Clone for Git

Source§

fn clone(&self) -> Git

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Git

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Git

§

impl RefUnwindSafe for Git

§

impl Send for Git

§

impl Sync for Git

§

impl Unpin for Git

§

impl UnsafeUnpin for Git

§

impl UnwindSafe for Git

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more