pub struct Client { /* private fields */ }Expand description
Ported from Client in client.go.
Implementations§
Trait Implementations§
Source§impl Backend for Client
impl Backend for Client
Source§fn clone(&self, repo_url: &str, directory: &str) -> Result<(), GitError>
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>
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>
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>
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>
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>
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>
fn get_current_branch(&self, directory: &str) -> Result<String, GitError>
Returns the current branch name, or empty if detached.
Source§fn get_tracking_branch(&self, directory: &str) -> Result<String, GitError>
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>
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>
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>
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>
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>
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.
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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