Skip to main content

SystemGit

Struct SystemGit 

Source
pub struct SystemGit {
    credentials: Option<RemoteCredentials>,
}
Expand description

Production Git adapter backed by libgit2.

Fields§

§credentials: Option<RemoteCredentials>

Implementations§

Source§

impl SystemGit

Source

pub const fn authenticated(credentials: RemoteCredentials) -> Self

An adapter that answers HTTPS authentication requests with credentials.

Source

fn proxy() -> ProxyOptions<'static>

Proxy settings taken from the Git configuration and environment, as the git command line uses them.

Source

fn open(path: &Path) -> Result<Repository, GitError>

Source

fn commit<'r>(repo: &'r Repository, rev: &str) -> Result<Commit<'r>, Git2Error>

The commit a revision expression names.

Source

fn origin(repo: &Repository) -> Result<Remote<'_>, GitError>

Source

fn worktree_name(path: &Path) -> String

The worktree and private branch name for a worktree directory, derived from its path so that removal finds what creation registered.

Source

fn callbacks(&self) -> RemoteCallbacks<'_>

Callbacks that offer the configured credential once per connection, so a rejected token fails instead of being retried forever.

Source

fn remote_head( &self, remote: &mut Remote<'_>, reference: &str, ) -> Result<Option<Oid>, GitError>

Read the head of reference on remote right now.

Source

fn push( &self, remote: &mut Remote<'_>, refspec: &str, reference: &str, ) -> Result<(), GitError>

Push refspec to remote, failing when the remote rejects an update.

Trait Implementations§

Source§

impl Clone for SystemGit

Source§

fn clone(&self) -> SystemGit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SystemGit

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SystemGit

Source§

fn default() -> SystemGit

Returns the “default value” for a type. Read more
Source§

impl GitCommands for SystemGit

Source§

type Error = GitError

The failure of a tag or authority operation.
Source§

fn authoritative_head( &self, repository: &Path, branch: &str, ) -> Result<String, Self::Error>

Commit branch points at now.
Source§

fn create_tag( &self, repository: &Path, tag: &str, commit: &str, author: Author<'_>, ) -> Result<(), Self::Error>

Create an annotated tag on commit locally, tagged by author.
Source§

fn push_tag(&self, repository: &Path, tag: &str) -> Result<(), Self::Error>

Push a local tag to origin.
Source§

impl GitHistory for SystemGit

Source§

type Error = GitError

The failure of a history read.
Source§

fn tags( &self, repository: &Path, prefix: &str, ) -> Result<Vec<String>, Self::Error>

List the tag names that start with prefix.
Source§

fn resolve(&self, repository: &Path, rev: &str) -> Result<String, Self::Error>

The commit a revision expression such as origin/main names.
Source§

fn has_changes( &self, repository: &Path, from: Option<&str>, to: &str, scope: UnitScope<'_>, ) -> Result<bool, Self::Error>

Whether scope differs between the commits from and to. Without from the comparison starts from the empty tree.
Source§

fn commit_messages( &self, repository: &Path, from: Option<&str>, to: &str, scope: UnitScope<'_>, ) -> Result<Vec<String>, Self::Error>

Messages of the commits after from up to to that change scope, oldest first. Without from the walk reaches the root commit. Merge commits are left out.
Source§

fn is_ancestor( &self, repository: &Path, ancestor: &str, descendant: &str, ) -> Result<bool, Self::Error>

Whether ancestor is descendant or reachable from it.
Source§

fn equivalent( &self, repository: &Path, base: &str, first: &str, second: &str, ) -> Result<bool, Self::Error>

Whether the first-parent chains from base to first and from base to second have the same length and the same trees and messages. A chain that does not reach base is equivalent to nothing.
Source§

impl GitRefs for SystemGit

Source§

type Error = GitError

The failure of a reference lookup.
Source§

fn reference( &self, repository: &Path, name: &str, ) -> Result<Option<String>, Self::Error>

The commit a full reference name points at, or None when the reference does not exist.
Source§

impl ProposalGit for SystemGit

Source§

fn push_with_lease( &self, worktree: &Path, branch: &str, expected: Option<&str>, ) -> Result<(), Self::Error>

Emulates --force-with-lease by reading the remote branch head immediately before a forced push; a concurrent update between the read and the push can still be overwritten.

Source§

type Error = GitError

The failure of a branch update.
Source§

fn fetch_if_present( &self, repository: &Path, refspec: &str, ) -> Result<(), Self::Error>

Like fetch, but succeed when the remote has no reference named by refspec.
Source§

fn fetch(&self, repository: &Path, refspec: &str) -> Result<(), Self::Error>

Update local references from origin as refspec maps them.
Source§

fn worktree_add( &self, repository: &Path, path: &Path, baseline: &str, ) -> Result<(), Self::Error>

Create a disposable worktree at the not yet existing path, checked out to baseline on a private branch.
Source§

fn worktree_remove( &self, repository: &Path, path: &Path, ) -> Result<(), Self::Error>

Remove a worktree created with ProposalGit::worktree_add.
Source§

fn stage_update( &self, worktree: &Path, paths: &[PathBuf], ) -> Result<(), Self::Error>

Stage the changes at these worktree-relative paths, tracked or not.
Source§

fn commit_if_staged( &self, worktree: &Path, message: &str, author: Author<'_>, ) -> Result<Option<String>, Self::Error>

Commit staged changes, returning the new commit hash, or None when nothing was staged.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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