Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Ported from Client in client.go.

Implementations§

Source§

impl Client

Source

pub fn new(executor: Arc<dyn CommandRunner + Send + Sync>) -> Self

Ported from NewClient.

Trait Implementations§

Source§

impl Backend for Client

Source§

fn clone(&self, repo_url: &str, directory: &str) -> Result<(), GitError>

Clones the repository to directory. If the directory already exists and contains a valid clone, this is a no-op.
Source§

fn pull(&self, directory: &str) -> Result<(), GitError>

Fetches and merges the latest changes from the remote.
Source§

fn get_revision(&self, directory: &str) -> Result<String, GitError>

Returns the current git revision (commit SHA).
Source§

fn get_status(&self, directory: &str) -> Result<Status, GitError>

Returns the current git status.
Source§

fn ensure_cloned( &self, repo_url: &str, directory: &str, clone_strategy: &str, ) -> Result<(), GitError>

Ensures the repository is cloned based on the clone strategy ("always" or "on-demand"/empty).
Source§

fn is_git_repository(&self, directory: &str) -> Result<bool, GitError>

Checks if the directory is a valid git repository.
Source§

fn get_current_branch(&self, directory: &str) -> Result<String, GitError>

Returns the current branch name, or empty if detached.
Source§

fn is_detached(&self, directory: &str) -> Result<bool, GitError>

Checks if HEAD is detached.
Source§

fn get_tracking_branch(&self, directory: &str) -> Result<String, GitError>

Returns the upstream tracking branch (e.g. “origin/main”), or empty if none is set.
Source§

fn get_default_branch( &self, directory: &str, repo_url: &str, ) -> Result<String, GitError>

Detects the default branch from the remote or origin/HEAD.
Source§

fn get_commit_counts(&self, directory: &str) -> Result<(i64, i64), GitError>

Returns (behind, ahead) counts vs the tracking branch.
Source§

fn detect_state( &self, directory: &str, configured_url: &str, ) -> Result<RepositoryState, GitError>

Detects the complete state of a repository. Fail-safe: continues collecting state even if some checks fail.
Source§

fn merge_ff_only(&self, directory: &str) -> Result<(), GitError>

Fast-forwards the current branch to its upstream; callers must fetch first.
Source§

fn fetch( &self, directory: &str, remote: &str, ref_: &str, ) -> Result<(), GitError>

Fetches a single ref from the given remote without merging; an empty ref fetches all branches.
Source§

fn checkout(&self, directory: &str, ref_: &str) -> Result<(), GitError>

Checks out the given ref (commit SHA, tag, or branch).
Source§

fn stash_push(&self, directory: &str, message: &str) -> Result<(), GitError>

Stashes uncommitted changes with an optional message.

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

Source§

impl<T> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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