Skip to main content

MockGitApi

Struct MockGitApi 

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

The Git operations this crate exposes — the interface consumers code against and mock in tests.

Injection safety: every method that places a caller-supplied name, revision, range, remote, or URL in a positional argv slot rejects a value that is empty or begins with - (it would be parsed as a flag) with an Error::Spawn before spawning. Flag-value slots (-m <msg>, --branch <b>), filesystem path arguments (---separated pathspecs, plus worktree paths and clone destinations — typed Path, caller-trusted), and the run/run_raw escape hatches are not guarded. For eager validation at an input boundary, see RefName / RevSpec.

Implementations§

Source§

impl MockGitApi

Source

pub fn checkpoint(&mut self)

Validate that all current expectations for all methods have been satisfied, and discard them.

Source

pub fn new() -> Self

Create a new mock object with no expectations.

This method will not be generated if the real struct already has a new method. However, it will be generated if the struct implements a trait with a new method. The trait’s new method can still be called like <MockX as TraitY>::new

Source§

impl MockGitApi

Source

pub fn expect_run(&mut self) -> &mut Expectation

Create an Expectation for mocking the run method

Source

pub fn expect_run_raw(&mut self) -> &mut Expectation

Create an Expectation for mocking the run_raw method

Source

pub fn expect_version(&mut self) -> &mut Expectation

Create an Expectation for mocking the version method

Source

pub fn expect_capabilities(&mut self) -> &mut Expectation

Create an Expectation for mocking the capabilities method

Source

pub fn expect_status(&mut self) -> &mut Expectation

Create an Expectation for mocking the status method

Source

pub fn expect_status_text(&mut self) -> &mut Expectation

Create an Expectation for mocking the status_text method

Source

pub fn expect_status_tracked(&mut self) -> &mut Expectation

Create an Expectation for mocking the status_tracked method

Source

pub fn expect_branch_status(&mut self) -> &mut Expectation

Create an Expectation for mocking the branch_status method

Source

pub fn expect_conflicted_files(&mut self) -> &mut Expectation

Create an Expectation for mocking the conflicted_files method

Source

pub fn expect_current_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the current_branch method

Source

pub fn expect_branches(&mut self) -> &mut Expectation

Create an Expectation for mocking the branches method

Source

pub fn expect_log(&mut self) -> &mut Expectation

Create an Expectation for mocking the log method

Source

pub fn expect_log_range(&mut self) -> &mut Expectation

Create an Expectation for mocking the log_range method

Source

pub fn expect_rev_parse(&mut self) -> &mut Expectation

Create an Expectation for mocking the rev_parse method

Source

pub fn expect_rev_parse_short(&mut self) -> &mut Expectation

Create an Expectation for mocking the rev_parse_short method

Source

pub fn expect_init(&mut self) -> &mut Expectation

Create an Expectation for mocking the init method

Source

pub fn expect_add(&mut self) -> &mut Expectation

Create an Expectation for mocking the add method

Source

pub fn expect_commit(&mut self) -> &mut Expectation

Create an Expectation for mocking the commit method

Source

pub fn expect_create_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the create_branch method

Source

pub fn expect_checkout(&mut self) -> &mut Expectation

Create an Expectation for mocking the checkout method

Source

pub fn expect_checkout_detach(&mut self) -> &mut Expectation

Create an Expectation for mocking the checkout_detach method

Source

pub fn expect_commit_paths(&mut self) -> &mut Expectation

Create an Expectation for mocking the commit_paths method

Source

pub fn expect_last_commit_message(&mut self) -> &mut Expectation

Create an Expectation for mocking the last_commit_message method

Source

pub fn expect_is_unborn(&mut self) -> &mut Expectation

Create an Expectation for mocking the is_unborn method

Source

pub fn expect_diff_is_empty(&mut self) -> &mut Expectation

Create an Expectation for mocking the diff_is_empty method

Source

pub fn expect_common_dir(&mut self) -> &mut Expectation

Create an Expectation for mocking the common_dir method

Source

pub fn expect_git_dir(&mut self) -> &mut Expectation

Create an Expectation for mocking the git_dir method

Source

pub fn expect_resolve_commit(&mut self) -> &mut Expectation

Create an Expectation for mocking the resolve_commit method

Source

pub fn expect_remote_head_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_head_branch method

Source

pub fn expect_branch_exists(&mut self) -> &mut Expectation

Create an Expectation for mocking the branch_exists method

Source

pub fn expect_remote_branch_exists(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_branch_exists method

Source

pub fn expect_remote_url(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_url method

Source

pub fn expect_upstream(&mut self) -> &mut Expectation

Create an Expectation for mocking the upstream method

Source

pub fn expect_remote_branches(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_branches method

Source

pub fn expect_is_merged(&mut self) -> &mut Expectation

Create an Expectation for mocking the is_merged method

Source

pub fn expect_set_upstream(&mut self) -> &mut Expectation

Create an Expectation for mocking the set_upstream method

Source

pub fn expect_delete_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the delete_branch method

Source

pub fn expect_rename_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the rename_branch method

Source

pub fn expect_rev_list_count(&mut self) -> &mut Expectation

Create an Expectation for mocking the rev_list_count method

Source

pub fn expect_diff_range_is_empty(&mut self) -> &mut Expectation

Create an Expectation for mocking the diff_range_is_empty method

Source

pub fn expect_diff_stat(&mut self) -> &mut Expectation

Create an Expectation for mocking the diff_stat method

Source

pub fn expect_diff_text(&mut self) -> &mut Expectation

Create an Expectation for mocking the diff_text method

Source

pub fn expect_diff(&mut self) -> &mut Expectation

Create an Expectation for mocking the diff method

Source

pub fn expect_staged_is_empty(&mut self) -> &mut Expectation

Create an Expectation for mocking the staged_is_empty method

Source

pub fn expect_is_rebase_in_progress(&mut self) -> &mut Expectation

Create an Expectation for mocking the is_rebase_in_progress method

Source

pub fn expect_is_merge_in_progress(&mut self) -> &mut Expectation

Create an Expectation for mocking the is_merge_in_progress method

Source

pub fn expect_fetch(&mut self) -> &mut Expectation

Create an Expectation for mocking the fetch method

Source

pub fn expect_fetch_from(&mut self) -> &mut Expectation

Create an Expectation for mocking the fetch_from method

Source

pub fn expect_fetch_remote_branch(&mut self) -> &mut Expectation

Create an Expectation for mocking the fetch_remote_branch method

Source

pub fn expect_push(&mut self) -> &mut Expectation

Create an Expectation for mocking the push method

Source

pub fn expect_merge_squash(&mut self) -> &mut Expectation

Create an Expectation for mocking the merge_squash method

Source

pub fn expect_merge_commit(&mut self) -> &mut Expectation

Create an Expectation for mocking the merge_commit method

Source

pub fn expect_merge_no_commit(&mut self) -> &mut Expectation

Create an Expectation for mocking the merge_no_commit method

Source

pub fn expect_merge_abort(&mut self) -> &mut Expectation

Create an Expectation for mocking the merge_abort method

Source

pub fn expect_merge_continue(&mut self) -> &mut Expectation

Create an Expectation for mocking the merge_continue method

Source

pub fn expect_reset_merge(&mut self) -> &mut Expectation

Create an Expectation for mocking the reset_merge method

Source

pub fn expect_reset_hard(&mut self) -> &mut Expectation

Create an Expectation for mocking the reset_hard method

Source

pub fn expect_rebase(&mut self) -> &mut Expectation

Create an Expectation for mocking the rebase method

Source

pub fn expect_rebase_abort(&mut self) -> &mut Expectation

Create an Expectation for mocking the rebase_abort method

Source

pub fn expect_rebase_continue(&mut self) -> &mut Expectation

Create an Expectation for mocking the rebase_continue method

Source

pub fn expect_stash_push(&mut self) -> &mut Expectation

Create an Expectation for mocking the stash_push method

Source

pub fn expect_stash_pop(&mut self) -> &mut Expectation

Create an Expectation for mocking the stash_pop method

Source

pub fn expect_worktree_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the worktree_list method

Source

pub fn expect_worktree_add(&mut self) -> &mut Expectation

Create an Expectation for mocking the worktree_add method

Source

pub fn expect_worktree_remove(&mut self) -> &mut Expectation

Create an Expectation for mocking the worktree_remove method

Source

pub fn expect_worktree_move(&mut self) -> &mut Expectation

Create an Expectation for mocking the worktree_move method

Source

pub fn expect_worktree_prune(&mut self) -> &mut Expectation

Create an Expectation for mocking the worktree_prune method

Source

pub fn expect_clone_repo(&mut self) -> &mut Expectation

Create an Expectation for mocking the clone_repo method

Source

pub fn expect_tag_create(&mut self) -> &mut Expectation

Create an Expectation for mocking the tag_create method

Source

pub fn expect_tag_create_annotated(&mut self) -> &mut Expectation

Create an Expectation for mocking the tag_create_annotated method

Source

pub fn expect_tag_list(&mut self) -> &mut Expectation

Create an Expectation for mocking the tag_list method

Source

pub fn expect_tag_delete(&mut self) -> &mut Expectation

Create an Expectation for mocking the tag_delete method

Source

pub fn expect_show_file(&mut self) -> &mut Expectation

Create an Expectation for mocking the show_file method

Source

pub fn expect_config_get(&mut self) -> &mut Expectation

Create an Expectation for mocking the config_get method

Source

pub fn expect_config_set(&mut self) -> &mut Expectation

Create an Expectation for mocking the config_set method

Source

pub fn expect_remote_add(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_add method

Source

pub fn expect_remote_set_url(&mut self) -> &mut Expectation

Create an Expectation for mocking the remote_set_url method

Source

pub fn expect_blame(&mut self) -> &mut Expectation

Create an Expectation for mocking the blame method

Source

pub fn expect_cherry_pick(&mut self) -> &mut Expectation

Create an Expectation for mocking the cherry_pick method

Source

pub fn expect_revert(&mut self) -> &mut Expectation

Create an Expectation for mocking the revert method

Source

pub fn expect_rebase_skip(&mut self) -> &mut Expectation

Create an Expectation for mocking the rebase_skip method

Trait Implementations§

Source§

impl Debug for MockGitApi

Source§

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

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

impl Default for MockGitApi

Source§

fn default() -> Self

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

impl GitApi for MockGitApi

The Git operations this crate exposes — the interface consumers code against and mock in tests.

Injection safety: every method that places a caller-supplied name, revision, range, remote, or URL in a positional argv slot rejects a value that is empty or begins with - (it would be parsed as a flag) with an Error::Spawn before spawning. Flag-value slots (-m <msg>, --branch <b>), filesystem path arguments (---separated pathspecs, plus worktree paths and clone destinations — typed Path, caller-trusted), and the run/run_raw escape hatches are not guarded. For eager validation at an input boundary, see RefName / RevSpec.

Source§

fn run<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run git <args> in the current directory, returning trimmed stdout (throws on a non-zero exit). A raw escape hatch for unmodelled commands.

Source§

fn run_raw<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<ProcessResult<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Like GitApi::run but never errors on a non-zero exit — returns the captured ProcessResult.

Source§

fn version<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Installed Git version (git --version).

Source§

fn capabilities<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<GitCapabilities>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The installed binary’s parsed version, as GitCapabilities (git --version). A value type — probe once and keep it; an unrecognisable version string is an Error::Parse.

Source§

fn status<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<StatusEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Working-tree status (git status --porcelain=v1 -z).

Source§

fn status_text<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Raw porcelain status text (git status --porcelain=v1) — the unparsed counterpart of status, mirroring vcs_jj status_text.

Source§

fn status_tracked<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<StatusEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Like status but ignoring untracked files (git status --porcelain=v1 -z --untracked-files=no) — “is the tracked tree dirty”, staged or not.

Source§

fn branch_status<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<BranchStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A combined branch + working-tree snapshot in one spawn (git status --porcelain=v2 --branch -z): HEAD, branch, upstream, ahead/behind, and change counts — the data a prompt/status-bar needs without N round-trips. See BranchStatus.

Source§

fn conflicted_files<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Paths with unresolved merge conflicts, repo-relative with / separators (git diff --name-only --diff-filter=U -z). Empty when there are none.

Source§

fn current_branch<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Current branch name (git rev-parse --abbrev-ref HEAD).

Source§

fn branches<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<Branch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Local branches, current one flagged (git branch).

Source§

fn log<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, max: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Commit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Latest max commits, newest first (git log).

Source§

fn log_range<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, range: &'life2 str, max: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Commit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Commits in range, newest first, up to max (git log <range>).

Source§

fn rev_parse<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a revision to a full hash (git rev-parse <rev>).

Source§

fn rev_parse_short<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a revision to its abbreviated hash (git rev-parse --short <rev>) — e.g. to label a detached HEAD.

Source§

fn init<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialise a repository (git init).

Source§

fn add<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, paths: &'life2 [PathBuf], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stage paths (git add -- <paths>).

Source§

fn commit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, message: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Commit staged changes (git commit -m).

Source§

fn create_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a branch without switching to it (git branch <name>).

Source§

fn checkout<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, reference: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Switch to a branch or revision (git checkout <reference>).

Source§

fn checkout_detach<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, commit: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check out a commit as a detached HEAD (git checkout --detach <commit>).

Source§

fn commit_paths<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: CommitPaths, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Commit exactly the spec’s paths’ working-tree content, ignoring the index (git commit [--amend] -m <message> --only -- <paths>); see CommitPaths.

Source§

fn last_commit_message<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The last commit’s full message (git log -1 --format=%B) — e.g. to pre-fill an amend.

Source§

fn is_unborn<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether HEAD is unborn — a fresh repo with no commits yet (git rev-parse --verify -q HEAD, exit-code mapped).

Source§

fn diff_is_empty<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether the working tree has no unstaged modifications to tracked files (git diff --quiet). Untracked files are not counted — this is not a full “is the working tree clean?” check; use status for that.

Source§

fn common_dir<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The repository’s common git directory (rev-parse --git-common-dir) — stable across linked worktrees.

Source§

fn git_dir<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This worktree’s git directory (rev-parse --git-dir).

Source§

fn resolve_commit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a revision to a commit hash, peeling tags (rev-parse --verify <rev>^{commit}).

Source§

fn remote_head_branch<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The remote’s default branch from symbolic-ref refs/remotes/origin/HEAD (short name only); None when origin/HEAD is unset.

Source§

fn branch_exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether a local branch exists (show-ref --verify --quiet refs/heads/<name>).

Source§

fn remote_branch_exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether origin has name, without fetching (ls-remote origin refs/heads/<name> — the fully-qualified ref, so foo can’t tail-match bar/foo). Runs with GIT_TERMINAL_PROMPT=0 and a 10s timeout so a missing credential or a flaky network can’t hang the call.

Source§

fn remote_url<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, remote: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

A remote’s URL (remote get-url <remote>).

Source§

fn upstream<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The current branch’s upstream, e.g. Some("origin/main") (rev-parse --abbrev-ref --symbolic-full-name @{u}); None when unset.

Source§

fn remote_branches<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, remote: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Branch names on remote, without fetching (ls-remote --heads <remote>).

Source§

fn is_merged<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, branch: &'life2 str, target: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Whether branch is fully merged into target (branch --merged <target>).

Source§

fn set_upstream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, branch: &'life2 str, upstream: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Set branch’s upstream to upstream (e.g. origin/main) (branch --set-upstream-to=<upstream> <branch>).

Source§

fn delete_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, force: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a local branch (branch -d, or -D when force).

Source§

fn rename_branch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, old: &'life2 str, new: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Rename a local branch (branch -m <old> <new>).

Source§

fn rev_list_count<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, range: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Count commits in a range (rev-list --count <range>).

Source§

fn diff_range_is_empty<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, range: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether a diff range is empty (diff --quiet <range>).

Source§

fn diff_stat<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, range: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<DiffStat>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Aggregate change stats for a range (diff --shortstat <range>). Named to match vcs_jj::JjApi::diff_stat.

Source§

fn diff_text<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: DiffSpec, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Raw git-format unified diff text for spec (diff <spec> --no-color --no-ext-diff -M) — stable machine output.

Source§

fn diff<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: DiffSpec, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileDiff>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Parsed per-file unified diff for spec, layered on diff_text.

Source§

fn staged_is_empty<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether the index has no staged changes (diff --cached --quiet).

Source§

fn is_rebase_in_progress<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether a rebase is in progress (a rebase-merge/rebase-apply dir exists under the git dir).

Source§

fn is_merge_in_progress<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Whether a merge is in progress (a MERGE_HEAD exists under the git dir).

Source§

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch from the default remote (fetch --quiet), with GIT_TERMINAL_PROMPT=0. Transient (network) failures are retried (3 attempts, 500 ms backoff).

Source§

fn fetch_from<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, remote: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetch from a named remote (fetch --quiet <remote>), with GIT_TERMINAL_PROMPT=0. Transient failures are retried like fetch.

Source§

fn fetch_remote_branch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetch a single branch from origin into its remote-tracking ref (fetch --quiet origin refs/heads/<b>:refs/remotes/origin/<b>), with GIT_TERMINAL_PROMPT=0. Transient failures are retried (3×, 500 ms).

Source§

fn push<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: GitPush, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Push to a remote (push [-u] <remote> <refspec>); see GitPush.

Source§

fn merge_squash<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, branch: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stage a branch’s changes without committing (merge --squash <branch>).

Source§

fn merge_commit<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: MergeCommit, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Merge a branch (merge [--no-ff] [-m <msg> | --no-edit] <branch>); with no message it takes the default merge message non-interactively (--no-edit). See MergeCommit.

Source§

fn merge_no_commit<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: MergeNoCommit, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Merge a branch but stop before committing, so the result can be inspected (merge --no-commit [--squash | --no-ff] <branch>). With no_ff (and not squash) git records MERGE_HEAD, so the in-progress merge is abortable via merge_abort — the dry-run pattern. With squash, git stages the squashed result but records no MERGE_HEAD, so it is not an abortable merge: undo it with reset_merge / reset_hard, not merge_abort. See MergeNoCommit.

Source§

fn merge_abort<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Abort an in-progress merge (merge --abort).

Source§

fn merge_continue<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Finish a merge after resolving conflicts (commit --no-edit).

Source§

fn reset_merge<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Undo an in-progress (or just-staged) merge: reset --merge resets the index and the merge-touched working-tree files back to HEAD and drops MERGE_HEAD, discarding the merge’s changes while keeping unrelated unstaged edits. Use it after merge_squash / merge_no_commit(squash), where there is no MERGE_HEAD for merge_abort to act on.

Source§

fn reset_hard<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Hard-reset the working tree to a revision (reset --hard <rev>).

Source§

fn rebase<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, onto: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Rebase the current branch onto onto (rebase <onto>); the editor is suppressed (GIT_EDITOR=true) so it never hangs a headless caller.

Source§

fn rebase_abort<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Abort an in-progress rebase (rebase --abort).

Source§

fn rebase_continue<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Continue a rebase after resolving conflicts (rebase --continue); the editor is suppressed (GIT_EDITOR=true) so the message-confirm never hangs.

Source§

fn stash_push<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, include_untracked: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stash the working tree (stash push, --include-untracked when asked) — e.g. to save state before a copy-on-write restore.

Source§

fn stash_pop<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore the most recent stash and drop it (stash pop).

Source§

fn worktree_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<Worktree>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List worktrees (worktree list --porcelain).

Source§

fn worktree_add<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: WorktreeAdd, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a worktree (worktree add [-b <branch>] <path> [<commitish>]).

Source§

fn worktree_remove<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, path: &'life2 Path, force: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a worktree (worktree remove [--force] <path>).

Source§

fn worktree_move<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, from: &'life2 Path, to: &'life3 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Move a worktree (worktree move <from> <to>).

Source§

fn worktree_prune<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Prune stale worktree admin entries (worktree prune).

Source§

fn clone_repo<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, url: &'life1 str, dest: &'life2 Path, spec: CloneSpec, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Clone url into dest (git clone <url> <dest> + CloneSpec flags). Runs without a working directory — pass an absolute dest.

Source§

fn tag_create<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, rev: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a lightweight tag at rev (tag <name> [<rev>]; None = HEAD).

Source§

fn tag_create_annotated<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, spec: AnnotatedTag, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an annotated tag (tag -a <name> -m <message> [<rev>]); see AnnotatedTag.

Source§

fn tag_list<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Tag names, sorted by git’s default ordering (tag --list).

Source§

fn tag_delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a tag (tag -d <name>).

Source§

fn show_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, path: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

A file’s content at a revision (git show <rev>:<path>). path is repo-relative; backslashes are normalised to / (git requires it). Content is decoded lossily — binary files come back mangled rather than erroring.

Source§

fn config_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The value of a config key, or None when unset (config --get <key>, whose exit 1 covers both “unset” and “no such section” — git doesn’t distinguish). A multi-valued key errors; read those via run.

Source§

fn config_set<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, key: &'life2 str, value: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Set a config key in the repository’s local config (config <key> <value>).

Source§

fn remote_add<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, url: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Add a remote (remote add <name> <url>).

Source§

fn remote_set_url<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, dir: &'life1 Path, name: &'life2 str, url: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Change a remote’s URL (remote set-url <name> <url>).

Source§

fn blame<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, path: &'life2 str, rev: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<BlameLine>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Per-line authorship of path (blame --line-porcelain [<rev>] -- <path>; None = the working tree’s HEAD).

Source§

fn cherry_pick<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Apply a commit onto the current branch (cherry-pick <rev>). A conflict surfaces as an error classified by is_merge_conflict.

Source§

fn revert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir: &'life1 Path, rev: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Revert a commit with the default message (revert --no-edit <rev>).

Source§

fn rebase_skip<'life0, 'life1, 'async_trait>( &'life0 self, dir: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Skip the current patch of a paused rebase (rebase --skip). Mainly for the apply backend’s “nothing to commit” stop — the default merge backend auto-drops emptied patches on --continue.

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

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

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.

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