Skip to main content

Git2Backend

Struct Git2Backend 

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

Implementations§

Source§

impl Git2Backend

Source

pub fn new() -> Self

Source§

impl Git2Backend

Source

pub fn without_lfs() -> Self

A backend that behaves as if git-lfs is not installed (see SystemGitBackend::without_lfs).

Trait Implementations§

Source§

impl Default for Git2Backend

Source§

fn default() -> Self

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

impl GitBackend for Git2Backend

Source§

fn status(&self, repo: &RepoRef) -> Result<WorkingTree>

Routed to the system git in an LFS repository: libgit2 has no clean filter, so it compares a smudged file with the pointer blob and reports every stat-dirty LFS file as modified (ADR 0009).

Source§

fn log(&self, repo: &RepoRef, opts: &LogOptions) -> Result<CommitGraph>

Native, except when a path filter is asked for.

git log -- <path> applies history simplification (a merge whose tree equals a parent’s along that path is pruned and only that parent followed); libgit2’s revwalk has no equivalent, so a hand-rolled filter would return a different commit list from SystemGitBackend on merge-heavy history. Dispatched per variant, like checkout(File) (see mutate::checkout).

Source§

fn diff(&self, repo: &RepoRef, target: DiffTarget) -> Result<Vec<FileDiff>>

Working-tree and index diffs go to the system git in an LFS repository (same reason as status); commit-to-commit diffs compare trees, never the working tree, so libgit2 keeps them.

Source§

fn index_tree(&self, repo: &RepoRef) -> Result<Oid>

Native: index_tree / index_restore are what every staging operation’s undo records, so they must cost no process.

Source§

fn snapshot_create(&self, repo: &RepoRef, paths: &[String]) -> Result<Snapshot>

Native: the snapshot builder and restorer (raw bytes, no filters, symlinks, the executable bit) cost no process.

Source§

fn file_history( &self, repo: &RepoRef, path: &Path, start: Oid, skip: usize, limit: usize, ) -> Result<FileHistoryPage>

libgit2 has no --follow; re-implementing git’s rename-chasing walk would make the backends disagree exactly where this feature matters, so it is one git log process either way.

Source§

fn stage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()>

File / Folder / All run on libgit2’s index (no spawn, one index write); Hunk / Line and every operation in an LFS repository (no LFS clean filter in libgit2, ADR 0009) go to the system git.

Source§

fn checkout(&self, repo: &RepoRef, target: &CheckoutTarget) -> Result<()>

Writes the working tree, so it goes to the system git: it smudges LFS files (ADR 0009) and, like every working-tree update here, leaves a folder it cannot remove (another program holds it open, on Windows) in place with a warning, where libgit2’s checkout fails half done.

Source§

fn tag_push<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, selection: &'life3 TagSelection, ) -> Pin<Box<dyn Future<Output = Result<PushOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Forwarded, like every other network operation here.

Pushing a tag also has to record the push in the remote-tag mirror, and that bookkeeping is what makes the backends agree about which tags are unpushed. The mirror therefore has exactly one writer, in gitpoulpi_cli_backend::tags; this backend only reads it (natively, in reads::refs).

Source§

fn reset(&self, repo: &RepoRef, target: Oid, mode: ResetMode) -> Result<()>

Soft only moves the branch, so it stays native; Mixed and Hard rewrite the index / working tree and go to the system git (LFS smudge, ADR 0009; folders that cannot be removed, see checkout).

Source§

fn split_source(&self, repo: &RepoRef, commit: Oid) -> Result<SplitSource>

System git: the byte-faithful partial patches live in the CLI backend’s patch.rs, as for hunk and line staging.

Source§

fn set_network_auth(&self, repo: &RepoRef, auth: Option<NetworkAuth>)

Networking is CliFallback, like fetch: the system-git layer is where the entry is applied.

Source§

fn clone_with_progress<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, url: &'life1 str, dest: &'life2 Path, opts: &'life3 CloneOptions, progress: CloneProgressSink<'life4>, ) -> Pin<Box<dyn Future<Output = Result<RepoRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Forwarded rather than reimplemented on libgit2’s own RemoteCallbacks::transfer_progress: clone is already CliFallback, and narrating through libgit2 would give the same operation two progress vocabularies depending on the backend. If clone ever becomes Native, the progress mapping moves with it.

Source§

fn conflict_entries(&self, repo: &RepoRef) -> Result<Vec<ConflictEntry>>

Native: libgit2 lists the index’s unmerged entries without a process or a blob read.

Source§

fn merge_document(&self, repo: &RepoRef, path: &Path) -> Result<MergeDocument>

Native stage reads; the 3-way merge of them is CliFallback (see reads::merge_document).

Source§

fn lost_commits( &self, repo: &RepoRef, opts: &LostCommitOptions, ) -> Result<LostCommitsPage>

CliFallback: the reachability walk is the CLI’s own, one implementation.

Source§

fn move_head_keep( &self, repo: &RepoRef, branch: &str, from: Oid, to: Oid, ) -> Result<()>

CliFallback: libgit2 has no reset --keep; one implementation, the CLI’s.

Source§

fn convert_files( &self, repo: &RepoRef, paths: &[String], op: ConvertOp, ) -> Result<ConvertReport>

CliFallback: plain file I/O over the shared textconv functions, one implementation so both backends write the same bytes.

Source§

fn gitattributes_treat( &self, repo: &RepoRef, paths: &[String], scope: RuleScope, file: Option<&str>, treat: Treat, ) -> Result<AttributesWrite>

CliFallback: the one implementation writes the attribute files and asks git check-attr, so both backends answer alike.

Source§

fn mailmap_identities( &self, repo: &RepoRef, scope: &Scope, options: &ScopeOptions, ) -> Result<IdentityList>

CliFallback: one git log counts the identities of a scope, and the .mailmap edit is plain file I/O; one implementation each.

Source§

fn submodule_init(&self, repo: &RepoRef, paths: &[String]) -> Result<()>

CliFallback: libgit2’s worktree_add cannot start a worktree on a new branch and a commit in one step, does not create missing parent folders, and names the admin entry differently from git worktree add – three ways for the two backends to disagree about the same worktree. One implementation, the CLI’s. CliFallback: submodule init/update clone and fetch through git’s own transports and credentials; libgit2’s submodule update needs callbacks for all of it. One implementation, the CLI’s.

Source§

fn patch_create( &self, repo: &RepoRef, source: &PatchSource, dest: &Path, ) -> Result<PatchCreated>

CliFallback: git format-patch/git diff --binary/git apply are the sources of truth for a patch’s exact bytes (base85 binary hunks, CRLF preservation); one implementation, the CLI’s.

Source§

fn remote_rename( &self, repo: &RepoRef, old_name: &str, new_name: &str, ) -> Result<()>

Forwarded: a rename also has to move the remote-tag mirror, and the mirror has exactly one writer (see tag_push).

Source§

fn resolve_conflict( &self, repo: &RepoRef, path: &Path, resolution: ConflictResolution, opts: &ResolveOptions, ) -> Result<()>

CliFallback: the resolution writes files, restores stages and shells the same git plumbing either way; one implementation is the identity guarantee.

Source§

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

Short implementation name ("git2" or "system"), for diagnostics.
Source§

fn discover(&self, path: &Path) -> Result<DiscoveredRepo>

Finds the repository enclosing path and describes it. Read more
Source§

fn init(&self, path: &Path, opts: &InitOptions) -> Result<RepoRef>

Creates a new repository at path and returns the RepoRef every later request for it will be keyed on. Read more
Source§

fn count_commits(&self, repo: &RepoRef, opts: &LogOptions) -> Result<u64>

How many commits log would return for opts if it were not paged: the same refs (all_refs, start_ref, HEAD) and path filter and hidden filter, skip and limit ignored. Counts without loading any commit’s text, so it stays cheap on a very large history. An unborn repository is 0. Read-only; nothing to journal.
Source§

fn diff_files(&self, repo: &RepoRef, target: DiffTarget) -> Result<DiffFileList>

The files diff lists for the same target - same paths, same statuses, same order - as cheaply as the backend can produce them. Read more
Source§

fn commit_stats(&self, repo: &RepoRef, ids: &[Oid]) -> Result<Vec<CommitStat>>

CommitStat for each of ids, in the order given, for the Log’s “Changes” column. Each is the commit against its first parent (a root commit against nothing) without rename detection, so files equals the length of diff(CommitVsParent(id)). A batch so the system backend can answer it with one process instead of one per commit. An empty ids is an empty answer; an unknown id is an error.
Source§

fn commit_messages( &self, repo: &RepoRef, query: &CommitMessagesQuery, ) -> Result<CommitMessages>

Every commit’s author, time, subject and body, for the workspace search index: the commits reachable from the branches, remote branches, tags and HEAD (not stashes, not GitPoulpi’s own refs), newest first, minus those reachable from query.known_tips (so an index is brought up to date by asking for what is new). See CommitMessages for tips, replace and truncated. A read.
Source§

fn diff_paths( &self, repo: &RepoRef, target: DiffTarget, paths: &[PathBuf], ) -> Result<Vec<FileDiff>>

diff restricted to paths: the hunks of just those files, so the Diff view can load one file’s hunks when it is opened. Read more
Source§

fn refs(&self, repo: &RepoRef) -> Result<Vec<Ref>>

Source§

fn ref_snapshot(&self, repo: &RepoRef, scope: &RefScope) -> Result<RefSnapshot>

Raw ref values (tag objects not peeled) under scope, plus HEAD (symbolic, possibly unborn, or detached). A read; the undo journal’s source of truth for “what did this operation change”. The hidden refs/gitpoulpi/ namespace is never listed.
Source§

fn update_refs( &self, repo: &RepoRef, updates: &[RefUpdate], reflog_message: &str, ) -> Result<()>

An atomic compare-and-swap ref transaction: every update applies or none does. A ref that does not hold the expected value is Error::UndoRefused(UndoRefusal::RefMoved); a HEAD that is not where SetHead expects is HeadMoved. SetHead re-points HEAD without touching the index or any file. reflog_message is written for every ref that moves.
Source§

fn index_restore(&self, repo: &RepoRef, tree: Oid) -> Result<()>

Makes the index equal tree exactly (git read-tree). Never touches the working tree. The undo journal’s primitive for stage/unstage; the caller has verified, under the repository’s write lock, that the index is what it expects.
Source§

fn snapshot_restore( &self, repo: &RepoRef, snapshot: Oid, paths: &[String], ) -> Result<()>

Writes a snapshot’s index and working-tree sides back for paths, exactly: a file the snapshot holds is rewritten (content, mode, symlink), and a file under paths that the snapshot does not hold is removed from the index and the disk. Index and working tree are restored independently of each other.
Source§

fn path_hashes(&self, repo: &RepoRef, paths: &[String]) -> Result<Vec<PathHash>>

The current PathHash of every file under paths that exists in the index or the working tree, sorted by path. Equal to snapshot_create(paths).hashes taken at the same instant. A read: the undo preconditions.
Source§

fn blob_bytes(&self, repo: &RepoRef, oid: Oid) -> Result<Vec<u8>>

The raw bytes of the blob oid (no filter, no decoding): what a snapshot’s [FileHash] names. “Restore only this” writes them next to a file that changed since. A missing object is an error.
Source§

fn reflog( &self, repo: &RepoRef, refname: &str, skip: usize, limit: usize, ) -> Result<ReflogPage>

One page of a reflog, newest entry first. refname is HEAD or a ref (refs/heads/main; a bare name is a local branch, see crate::domain::reflog_refname). old/new are the values git stored, old being all zeros for the first entry. A ref with no reflog (a deleted branch, a tag, core.logAllRefUpdates off) is an empty page, not an error. A read; shows moves made outside GitPoulpi too.
Source§

fn config_section( &self, repo: &RepoRef, section: &str, ) -> Result<Vec<(String, String)>>

The key = value pairs of one repository-local config section, full keys (branch.x.remote), in file order. Only the sections branch.<name> and remote.<name> are accepted (an undo helper, not a general config reader).
Source§

fn remote_dependents(&self, repo: &RepoRef, remote: &str) -> Result<Vec<String>>

The branch.<name> sections whose remote is remote, sorted: what git remote remove deletes and git remote rename rewrites besides the remote’s own section.
Source§

fn set_config_section( &self, repo: &RepoRef, section: &str, entries: &[(String, String)], ) -> Result<()>

Replaces the whole section with entries (empty removes it). Same restriction as GitBackend::config_section.
Source§

fn stashes(&self, repo: &RepoRef) -> Result<Vec<Stash>>

Source§

fn remotes(&self, repo: &RepoRef) -> Result<Vec<Remote>>

Source§

fn worktrees(&self, repo: &RepoRef) -> Result<Vec<Worktree>>

Every worktree of repo, main one first (see Worktree).
Source§

fn submodules(&self, repo: &RepoRef) -> Result<Vec<Submodule>>

Every submodule .gitmodules declares, sorted by path, with its state against what the superproject records. Top level only: a submodule’s own submodules are listed by that repository. An uninitialized submodule is listed (state Uninitialized, no head); a repository without .gitmodules answers an empty list without spawning anything.
Source§

fn resolve(&self, repo: &RepoRef, rev: &str) -> Result<Oid>

Turns any revision spelling git accepts (HEAD, HEAD~2, a branch or tag name, a full or abbreviated sha) into the Oid of the commit it names, peeling annotated tags on the way. Read more
Source§

fn merge_base(&self, repo: &RepoRef, a: Oid, b: Oid) -> Result<Option<Oid>>

The best common ancestor of two commits (git merge-base a b), or None when their histories share nothing. A read; the code review view diffs merge_base(base, head)..head, which is what a host shows.
Source§

fn ahead_behind( &self, repo: &RepoRef, tip: Oid, base: Oid, ) -> Result<(u32, u32)>

(ahead, behind) of tip against base: the commits reachable from tip but not from base, and the reverse (rev-list --left-right --count tip...base). A read; the branching workflow’s “behind its parent by n”.
Source§

fn cherry_counts( &self, repo: &RepoRef, local: Oid, remote: Oid, ) -> Result<(u32, u32)>

Like Self::ahead_behind but patch-equivalent commits do not count (rev-list --cherry-pick --left-right --count local...remote): (local_unmatched, remote_unmatched). A remote that only holds older copies of rebased local commits reads (n, 0) here while ahead_behind says it diverged. A read.
Source§

fn predict_merge_conflicts( &self, repo: &RepoRef, ours: Oid, theirs: Oid, ) -> Result<Vec<String>>

The paths a merge of theirs into ours would leave conflicted, sorted and without duplicates, computed without touching the work tree, the index, HEAD or any ref (proactive conflict detection). Empty when the merge would go through, including when one commit contains the other. Read more
Source§

fn read_blob( &self, repo: &RepoRef, path: &Path, source: &BlobSource, ) -> Result<Blob>

A file’s content - as opposed to a diff of it - at a commit, at the index, or on disk (see BlobSource). Read more
Source§

fn read_blob_bytes( &self, repo: &RepoRef, path: &Path, source: &BlobSource, max: u64, ) -> Result<BlobBytes>

A file’s exact bytes at source (same sources and path rules as GitBackend::read_blob): no smudge filter, no decoding. What an image viewer needs, since read_blob drops the bytes of a binary file. Read more
Source§

fn list_tree(&self, repo: &RepoRef, at: Oid) -> Result<Vec<PathBuf>>

Every path present in the repository at at, sorted, with / separators - the whole tree, not the subset a commit changed (what the View all files toggle needs). Read more
Source§

fn grep_tree( &self, repo: &RepoRef, at: Oid, terms: &[String], max_hits: usize, ) -> Result<Vec<GrepHit>>

The lines of the files at at that contain any of terms (plain strings, case-sensitive), at most max_hits for each term, sorted by path then line. A read: nothing is journaled. Read more
Source§

fn mailmap_resolve( &self, repo: &RepoRef, idents: &[Ident], ) -> Result<Vec<Ident>>

Each of idents as the repository’s .mailmap (and mailmap.file) shows it, in the same order: the canonical name and email, or the identity itself when nothing maps it. The system backend asks git check-mailmap, Git2Backend libgit2’s Mailmap; the contract suite pins that they agree. A read.
Source§

fn blame(&self, repo: &RepoRef, path: &Path, at: Oid) -> Result<Blame>

Per-line attribution for path as of the commit at. Read more
Source§

fn unstage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()>

Source§

fn commit( &self, repo: &RepoRef, message: &str, opts: &CommitOptions, ) -> Result<Oid>

Source§

fn discard(&self, repo: &RepoRef, paths: &[String]) -> Result<()>

Discards every uncommitted change to each of paths (relative to the repository root, /-separated): a tracked path’s index entry and working-tree copy are both reset back to HEAD, and a path with no HEAD entry (untracked, or staged but never committed) is removed from the index if present and deleted from the working tree. Read more
Source§

fn branch_create(&self, repo: &RepoRef, name: &str, at: Oid) -> Result<()>

Source§

fn branch_create_tracking( &self, repo: &RepoRef, local_name: &str, upstream: &str, ) -> Result<()>

Create the local branch local_name tracking the remote-tracking branch upstream (spelled the way RefKind::RemoteBranch spells it, origin/feature/login) and check it out - what git checkout -b <local_name> --track <upstream> does, in one operation. Read more
Source§

fn branch_delete(&self, repo: &RepoRef, name: &str) -> Result<()>

Source§

fn branch_rename( &self, repo: &RepoRef, old_name: &str, new_name: &str, ) -> Result<()>

Source§

fn branch_set_upstream( &self, repo: &RepoRef, branch: &str, upstream: Option<&str>, ) -> Result<()>

Sets the local branch branch’s upstream to the remote-tracking branch upstream (spelled origin/feature, as RefKind::RemoteBranch joins it), or removes it with None – git branch --set-upstream-to / --unset-upstream. Read more
Source§

fn fast_forward( &self, repo: &RepoRef, branch: &str, target: Oid, ) -> Result<FastForwardOutcome>

Moves the local branch branch forward to the commit target, only when that is a fast-forward - the Fast-forward <branch> to <other> action. Read more
Source§

fn tag_create( &self, repo: &RepoRef, name: &str, at: Oid, annotated_message: Option<&str>, ) -> Result<()>

Source§

fn tag_delete(&self, repo: &RepoRef, name: &str) -> Result<()>

Source§

fn tag_annotate(&self, repo: &RepoRef, name: &str, message: &str) -> Result<()>

Replaces the existing tag name with an annotated tag carrying message, at the same commit. Read more
Source§

fn tag_move( &self, repo: &RepoRef, name: &str, to: Oid, force: bool, ) -> Result<()>

Moves the existing local tag name to the commit to, keeping its kind: a lightweight tag stays a ref to the commit, an annotated one is re-created with the same message and tagger line verbatim (see crate::domain::retarget_tag_object), so only the object it points at changes. A signed tag is refused (its signature would no longer match), as is a tag of anything but a commit. Read more
Source§

fn tag_merge_branch( &self, repo: &RepoRef, name: &str, branch: &str, message: Option<&str>, ) -> Result<Oid>

Merges the branch (or any revision) branch into the commit tag name points at, then moves the tag onto the merge commit, whose parents are the tag’s old commit and branch’s tip. Returns the merge commit. Read more
Source§

fn tag_take_remote( &self, repo: &RepoRef, remote: &str, name: &str, ) -> Result<()>

Moves the local tag name to what remote has under that name, as the tag mirror knows it (the last fetch or push): no network. The mirror’s object is taken as is, so an annotated tag becomes that very tag object, never a lightweight tag at its commit. The “Use the remote’s version” of a tag that differs. An error when no mirror ref names that tag on that remote, or when there is no local tag to move.
Source§

fn tag_force_push<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, name: &'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,

Force-pushes the local tag name to remote, leased on the value the tag mirror says the remote has (--force-with-lease=<ref>:<mirror>): a remote that moved since the last fetch is refused, typed (crate::Error::PushRejected with StaleLease), and nothing is overwritten. The mirror follows on success. An error when the mirror has no such tag on that remote (use tag_push for a tag the remote lacks) or there is no local tag. Network.
Source§

fn tag_delete_remote<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, name: &'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,

Deletes tag name from remote (git push --delete), leaving the local tag alone. Read more
Source§

fn tag_fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, name: &'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,

Fetches the single tag name from remote into refs/tags/ - the “Fetch this tag” of a remote-only tag. Never overwrites: a local tag of that name at another commit is an error, not a silent loss. Network. The remote tag mirror already knows the tag, so it is not rewritten.
Source§

fn branch_delete_remote<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, name: &'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,

Deletes branch name from remote (push --delete), leaving any local branch of that name alone; the remote-tracking ref goes with it. The remote twin of GitBackend::branch_delete, which must not touch the remote.
Source§

fn remote_ref_value<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, full_ref: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Oid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

What remote holds at the fully qualified full_ref (refs/heads/x or refs/tags/v1) right now, asked of the server (ls-remote); None when it has no such ref. For an annotated tag, the tag object. A network read, never answered from local tracking refs. It is the value an undo of a remote deletion records and later checks.
Source§

fn remote_ref_update<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, full_ref: &'life3 str, new: Option<Oid>, expect: Option<Oid>, ) -> 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,

Moves the branch or tag full_ref on remote from expect to new, never forced: Some(oid) pushes that object there (it re-creates a deleted ref when expect is None), None deletes the ref. The remote must hold expect at that moment (a lease); if it moved on, crate::Error::PushRejected with StaleLease comes back and nothing changed. An object this repository no longer has is crate::Error::UndoRefused with RemoteObjectMissing. Network. The remote-tracking ref (branch) or remote-tag mirror (tag) follows.
Source§

fn rebase_state(&self, repo: &RepoRef) -> Result<Option<RebaseState>>

The state of a rebase (interactive or plain) currently in progress, or None if none is. A read.
Source§

fn reword( &self, repo: &RepoRef, commit: Oid, message: &str, ) -> Result<RewordOutcome>

Gives commit the message message, keeping everything else. Read more
Source§

fn amend_commit( &self, repo: &RepoRef, commit: Oid, amend: &CommitAmend, ) -> Result<RewordOutcome>

GitBackend::reword generalised to the commit’s other properties: whichever of amend’s message, author name/email/date and committer name/email/date are Some replace the commit’s; the rest (tree, parents, every None) is kept. Same walk, same descendants re-created on top (their own authors kept), same guarantees (index and working tree untouched, no rebase) and the same typed refusals, plus InvalidIdentity and InvalidDate; crate::domain::CommitAmend::resolve runs first. Unless a committer field says otherwise the committer is the current identity, now. The reflog entry reads amend: <oid> <summary>.
Source§

fn split_commit( &self, repo: &RepoRef, req: &SplitCommit, ) -> Result<SplitOutcome>

Breaks req.commit into req.parts (oldest first) by plumbing, as reword does: the last part carries the original tree, the descendants are re-created on top, the index and working tree are never touched. Refusals are crate::Error::SplitRefused and crate::domain::validate_split runs first.
Source§

fn rewrite_preview( &self, repo: &RepoRef, recipe: &Recipe, progress: RewriteProgressSink<'_>, ) -> Result<RewritePlan>

Computes recipe into a temporary pack under the repository’s gitpoulpi/rewrite/<run>/ directory and describes the result; no ref and no object store moves. A read. The preview is the real run: GitBackend::rewrite_apply indexes exactly that pack. progress returning Break cancels and leaves nothing behind. Refusals are crate::Error::RewriteRefused; crate::domain::rewrite::validate_recipe runs first.
Source§

fn rewrite_apply( &self, repo: &RepoRef, plan: &RewritePlan, ) -> Result<RewriteOutcome>

Indexes the previewed pack and moves every ref in one transaction with compare-and-swap on the old values (a moved ref fails the whole run, RewriteRefusal::Stale). Journaled by the daemon as one entry.
Source§

fn rewrite_extract( &self, repo: &RepoRef, plan: &RewritePlan, target: &Path, ) -> Result<RewriteOutcome>

Applies a preview whose recipe extracts a subdirectory as a new repository (ExtractMode::Clone or Submodule) instead of moving this repository’s refs: a git clone --no-local of this repository into target (a folder that does not exist or is empty) is rewritten there with the recipe, then cleaned of the old history. Clone leaves this repository untouched and the outcome moves no ref here; Submodule also adds one commit to the current branch that replaces the folder by a submodule of target (the outcome’s one ref change), the old history stays. Journaled by the daemon (a submodule commit is undone by moving the branch back). Error::RewriteRefused otherwise.
Source§

fn rewrite_load( &self, repo: &RepoRef, run: &RunId, ) -> Result<Option<RewritePlan>>

A previewed plan, without its rows, rebuilt from the run directory the preview left (so a preview outlives its daemon). None when the run is gone or its stored plan does not hash to its digest.
Source§

fn rewrite_record(&self, repo: &RepoRef, run: &RunId) -> Result<RewriteRecord>

What an applied run moved, from the record its apply left in the run directory (moved.json), with the directory the maps are in. This is what the collaborator note and the push are built from; it outlives the daemon. RewriteRefusal::Stale when the run was not applied here or its directory was swept.
Source§

fn rewrite_maps( &self, repo: &RepoRef, run: &RunId, out: Option<&Path>, ) -> Result<RewriteMaps>

The run’s commit-map and ref-map (git-filter-repo’s format), copied to out when given. A read.
Source§

fn push_rewritten<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, req: &'life2 PushRewritten, ) -> Pin<Box<dyn Future<Output = Result<PushRewrittenOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Pushes the refs an applied run moved that were on a remote, each with --force-with-lease=<ref>:<the remote's id when the preview ran> (never a plain force), one --atomic push per remote where the server allows it. Protected refs are left out unless asked for. A rejection is a per-ref status in the answer, not an error. Not journaled and not undoable; the record of what was pushed lets a later undo of the rewrite warn.
Source§

fn rewrite_purge( &self, repo: &RepoRef, req: &PurgeRequest, progress: PurgeProgressSink<'_>, ) -> Result<PurgeOutcome>

Deletes the old history of rewrite journal entries from this repository for good: drops the entries’ undo pins, expires the reflogs that name the old commits, removes the applied runs’ folders, prunes the object store (gc --prune=now), then checks that every object reachable only from the old tips is gone. Anything that still holds the old history (a branch outside the rewrite’s scope, a stash, another worktree’s HEAD, a remote-tracking ref, a pin of an entry that is not part of the request, …) is a typed crate::domain::rewrite::PurgeBlocker and the call changes nothing (PurgeStatus::Blocked). With dry_run it only reports (Ready or Blocked). Stashes are never expired. Not journaled and not undoable; the daemon marks the entries Purged. progress is told each step; there is no cancel.
Source§

fn rewrite_blob_diff( &self, repo: &RepoRef, run: &RunId, commit: Oid, path: &str, ) -> Result<BlobChange>

What a content rule did to path in the preview’s commit commit: the old and the new file, diffed (the new one is read back from the preview’s temporary pack). Lines a secret rule removed are hidden. A read. RewriteRefusal::Stale when the run is gone.
Source§

fn rewrite_script_check( &self, repo: &RepoRef, script: &ScriptRef, policy: &ScriptPolicy, ) -> Result<ScriptCheck>

Compiles a script (an inline text, or a file of the repository) and reports its header, the functions it defines and every problem. A syntax error is a problem in the answer, not an error. A read. Error::Unsupported without the rewrite-scripts feature. Read more
Source§

fn rewrite_script_test( &self, repo: &RepoRef, script: &ScriptRef, policy: &ScriptPolicy, commits: &[Oid], ) -> Result<Vec<ScriptTestRow>>

Runs a script on commits (their original data, in history order, state carried across them) and returns what it would change. Nothing is written. RewriteRefusal::ScriptFailed names the commit and the reason. A read. An external script that policy does not allow, whose interpreter is missing or that is not trusted is refused before it runs (ScriptsDisabled, ToolMissing, ScriptNotTrusted).
Source§

fn rewrite_analyze( &self, repo: &RepoRef, scope: &Scope, top: u32, progress: RewriteProgressSink<'_>, ) -> Result<SizeAnalysis>

The size analysis of the history scope walks (slice S18): the top largest blobs with their paths, first and last commit and whether they are still in HEAD, the biggest folders (unique blob bytes), the paths deleted from HEAD but kept by the history, and the totals with what removing the history-only data would free (an estimate: after a purge and a gc only). One log --raw pass plus one cat-file --batch-check. progress reports and can cancel. A read.
Source§

fn rewrite_scan_secrets( &self, repo: &RepoRef, scope: &Scope, progress: RewriteProgressSink<'_>, ) -> Result<SecretScan>

Scans the history of scope for secrets (token prefixes, private keys, passwords in URLs, password = value with enough entropy): every unique blob is read once, text only. The answer holds each finding’s rule, path, first and last commit, counts and a redacted preview, never its value; a finding’s id is stable, and a content rule with scan: true names findings by id (the backend resolves them at preview time). progress reports and can cancel. A read.
Source§

fn rewrite_discard(&self, repo: &RepoRef, run: &RunId) -> Result<()>

Deletes a preview’s temporary objects. Idempotent.
Source§

fn remote_access_check<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, opts: &'life3 RemoteAccessOptions, ) -> Pin<Box<dyn Future<Output = Result<RemoteAccessReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Connection test: git ls-remote --heads against remote’s fetch URL (its push URL with RemoteAccessOptions::push), with the repository’s NetworkAuth applied like for any transfer. A failed connection is not an Err: it is a report with ok: false and a classified crate::ErrorDetail. Err is for a remote that does not exist or a git that cannot start. A read: nothing in the repository changes.
Source§

fn fetch<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, opts: &'life3 FetchOptions, ) -> Pin<Box<dyn Future<Output = Result<FetchOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn fetch_all<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, opts: &'life2 FetchOptions, ) -> Pin<Box<dyn Future<Output = Result<FetchOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches every configured remote (git fetch --all), with --prune when asked, and refreshes each remote’s tag mirror the way GitBackend::fetch does for one. Read more
Source§

fn fetch_ref_as_branch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, remote_ref: &'life3 str, branch: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<FetchOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Fetches one remote_ref of remote that a normal fetch does not bring - a pull/merge request head such as refs/pull/<n>/head or refs/merge-requests/<n>/head, which is where a fork’s commits live - and makes the local branch branch track it. Read more
Source§

fn fetch_refspec<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, refspec: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<FetchOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Fetches one [+]refs/<src>:refs/gitpoulpi/<dst> spec from remote (a pull/merge request’s head into refs/gitpoulpi/pr/<n>, for in-app review). Never a branch, tag or remote-tracking ref: the destination must sit strictly inside crate::domain::FETCH_REFSPEC_NAMESPACE and anything else is refused before git runs (see crate::domain::parse_fetch_refspec). Nothing is checked out, and the destination is force-updated (a request may be force-pushed). Not journaled and not undoable: it only refreshes a read-only cache ref no user workflow points at. Returns the destination ref in updated_refs.
Source§

fn pull<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, opts: &'life2 PullOptions, ) -> Pin<Box<dyn Future<Output = Result<PullOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Pulls into the checked-out branch, integrating as crate::domain::PullMode says - always explicitly, so the user’s pull.rebase / pull.ff cannot change what was asked. Read more
Source§

fn pull_fetch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, opts: &'life2 PullOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The download half of GitBackend::pull: fetches what the pull would integrate and touches nothing else (no index, working tree or HEAD), so the daemon can cancel it by dropping the future. The default does nothing: a backend without a separate download phase does it all in GitBackend::pull_integrate.
Source§

fn pull_integrate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, opts: &'life2 PullOptions, ) -> Pin<Box<dyn Future<Output = Result<PullOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The integrate half: merges, fast-forwards or rebases what GitBackend::pull_fetch downloaded, without touching the network, and gives pull’s outcome and errors. This is the point of no return of a pull: it rewrites the index and the working tree, so it must not be interrupted. The default is the whole pull.
Source§

fn push<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, opts: &'life3 PushOptions, ) -> Pin<Box<dyn Future<Output = Result<PushOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Pushes a local branch (opts.branch, or the checked-out one) to the same-named branch on remote. Read more
Source§

fn push_for_review<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, branch: &'life3 str, topic: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<PushOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Pushes HEAD to refs/for/<branch> on remote - how a Gerrit change is created - with the optional %topic=<topic> option. branch is the Gerrit target branch (main), not a local one. Never forced. Not journaled and not undoable: the change lives on the server (abandon it there). The default is Unsupported.
Source§

fn clone<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, url: &'life1 str, dest: &'life2 Path, opts: &'life3 CloneOptions, ) -> Pin<Box<dyn Future<Output = Result<RepoRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn remote_set_url(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()>

Sets a remote’s fetch URL (remote.<name>.url).
Source§

fn remote_set_push_url( &self, repo: &RepoRef, name: &str, url: Option<&str>, ) -> Result<()>

Sets a remote’s separate push URL (remote.<name>.pushurl), or removes it with None so pushes go to the fetch URL again. crate::domain::Remote::push_url always reports the URL a push would actually use, so after None it equals the fetch URL.
Source§

fn ssh_command(&self, repo: &RepoRef) -> Result<Option<String>>

The repository-local core.sshCommand, if one is set. Read-only companion of Self::set_ssh_command.
Source§

fn set_ssh_command(&self, repo: &RepoRef, command: Option<&str>) -> Result<()>

Sets (or, with None, removes) the repository-local core.sshCommand - the opt-in way to make one repository use a profile’s SSH key (ADR-0008). Clearing an unset value is not an error. Only core.sshCommand is reachable: this is deliberately not a general config write.
Source§

fn repo_config(&self, repo: &RepoRef, key: &str) -> Result<Option<String>>

The repository-local value of key (the repo’s own config file, not the global or system one), or None when unset. key must be on crate::repo_config::REPO_CONFIG_KEYS (core.autocrlf, core.eol).
Source§

fn sparse_checkout_status(&self, repo: &RepoRef) -> Result<SparseState>

Whether the working tree is a sparse checkout, in which mode, and which directories are checked out. A repository that never enabled it reports SparseState::default() (disabled), never an error.
Source§

fn sparse_checkout_set(&self, repo: &RepoRef, dirs: &[String]) -> Result<()>

Makes the checkout sparse (cone mode) showing exactly dirs plus the files at the root; replaces any earlier set, so directories left out disappear from the working tree and the new ones appear. dirs go through crate::domain::normalize_sparse_dirs (at least one, relative, no patterns). Not journaled: nothing is lost, “disable” brings every file back.
Source§

fn sparse_checkout_disable(&self, repo: &RepoRef) -> Result<()>

Turns sparse checkout off: every file of the tree is checked out again. Disabling a repository that is not sparse is not an error.
Source§

fn set_repo_config( &self, repo: &RepoRef, key: &str, value: Option<&str>, ) -> Result<()>

Sets (or, with None, removes) the repository-local key, so the repository inherits the global value again. Same allow-list as Self::repo_config, and the value must be one the key accepts. Clearing an unset key is not an error.
Source§

fn config_entries( &self, repo: &RepoRef, prefixes: &[&str], ) -> Result<Vec<(String, String)>>

The entries of the repository-local config (.git/config only, not the global or system files) whose key starts, case-insensitively, with one of prefixes ("gitflow.", "branch."), as (key, value) in file order, keys spelled as config --list does (section and variable lower-cased, subsection as written). Not limited to the crate::repo_config::REPO_CONFIG_KEYS allow-list: it is read-only and meant for other tools’ settings (git-flow, Git Town) and the recorded parent of a branch (branch.<b>.gitpoulpi-parent). An entry without a value is skipped.
Source§

fn lfs_files(&self, repo: &RepoRef, at: Option<Oid>) -> Result<Vec<LfsFile>>

The LFS pointer files at a commit (Some) or in the index (None), each with whether its real object is in the local LFS store. Needs no git-lfs program. The index answer is empty for a repository that does not use LFS; a commit is scanned whatever the checked-out attributes say.
Source§

fn lfs_locks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<LfsLock>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The file locks held on the LFS server behind remote, each marked ours when the current user holds it. Network; a read (never broadcasts RepoChanged). Locking is a server feature reached with the remote’s own credentials. A server without locking answers git-lfs’s locks with an empty list, so that is what this returns; crate::Error::LfsLockingUnsupported comes from lfs_lock.
Source§

fn lfs_lock<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, path: &'life3 Path, ) -> Pin<Box<dyn Future<Output = Result<LfsLock>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Locks path on the server, so nobody else can lock or push changes to it. Network. A server without the locking API is crate::Error::LfsLockingUnsupported.
Source§

fn lfs_unlock<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, path: &'life3 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, 'life3: 'async_trait,

Releases the lock on path. Somebody else’s lock is refused unless force (which breaks it: destructive). Network.
Source§

fn lfs_fetch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, opts: &'life3 LfsFetchOptions, progress: LfsProgressSink<'life4>, ) -> 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, 'life4: 'async_trait,

git lfs fetch <remote>: download the LFS objects the current ref (or every ref with opts.all_refs) points at into the local LFS store, leaving the working tree alone. Network. Reports progress to progress; the last report is always done: true, and no direction’s counters ever decrease (the contract suite pins both). Needs the git-lfs program (crate::Error::LfsUnavailable).
Source§

fn lfs_pull<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, progress: LfsProgressSink<'life3>, ) -> 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,

git lfs pull <remote>: fetch, then replace the pointer files in the working tree with the real content. Network.
Source§

fn lfs_checkout<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, paths: &'life2 [PathBuf], progress: LfsProgressSink<'life3>, ) -> 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,

git lfs checkout [paths]: write the real content of every LFS pointer in the working tree (or only paths, relative to the root; empty means all) from the objects already in the local LFS store. Offline: it never downloads (that is lfs_pull). Installs the repository-local LFS filters first when they are missing, like lfs_pull. Not a journaled state change: it only expands pointers. Needs the git-lfs program (crate::Error::LfsUnavailable).
Source§

fn lfs_push<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, repo: &'life1 RepoRef, remote: &'life2 str, opts: &'life3 LfsPushOptions, progress: LfsProgressSink<'life4>, ) -> 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, 'life4: 'async_trait,

git lfs push <remote>: upload the LFS objects of the current branch (or of every ref with opts.all_refs). Network; a mutation of the remote.
Source§

fn conflicts(&self, repo: &RepoRef) -> Result<Vec<ConflictSet>>

Source§

fn delete_files(&self, repo: &RepoRef, paths: &[String]) -> Result<()>

Deletes paths (files, or directories with everything below) from the working tree; the index is not touched, so a tracked file shows up as a deleted change, as with rm. A path that does not exist is ignored; a path outside the repository or inside .git is an error. The daemon-side home of the TUI’s “Delete file”, so it can be journaled and undone.
Source§

fn gitignore_add( &self, repo: &RepoRef, pattern: &str, file: Option<&str>, ) -> Result<bool>

Appends pattern as its own line to the .gitignore named by file (repo-relative, default .gitignore; its file name must be .gitignore), creating the file and keeping an existing last line intact. Ok(false) when the pattern is already a line of the file (nothing written). The daemon-side home of the TUI’s “Ignore” menu, so it can be journaled and undone.
Source§

fn binary_paths(&self, repo: &RepoRef, paths: &[String]) -> Result<Vec<bool>>

For each of paths, in order: does git diff treat it as binary? The diff attribute decides when a rule sets or unsets it (binary unsets it); otherwise the content does, with git’s own sniff (a NUL in the first 8000 bytes of the working-tree file). A read.
Source§

fn mailmap_add( &self, repo: &RepoRef, canonical: &Ident, from: &[Ident], file: Option<&str>, ) -> Result<MailmapAdded>

Appends the lines that map each of from to canonical to the .mailmap (file: repo-relative, default .mailmap; created when missing), once each. Nothing is committed. Journaled like GitBackend::gitignore_add: undo puts the previous file back.
Source§

fn patch_files(&self, repo: &RepoRef, patch: &Path) -> Result<Vec<String>>

The repo-relative paths a patch file would touch (every side of a rename), without applying it: what to snapshot before GitBackend::patch_apply.
Source§

fn discard_part(&self, repo: &RepoRef, target: &DiscardTarget) -> Result<()>

Reverts one hunk, or some changed lines of one hunk, of a file’s unstaged changes in the working tree - the working-tree half of what GitBackend::unstage does to the index with the same selection, and the “Discard Hunk” / “Discard this line” actions. Read more
Source§

fn submodule_update( &self, repo: &RepoRef, opts: &SubmoduleUpdateOptions, ) -> Result<()>

git submodule update [--init] [--recursive] [-- paths]: checks each submodule out at the commit the superproject records, cloning it first with init. May reach the network (the submodule’s remote), so a caller that cares about prompts applies credentials.https_mode first, as the daemon does.
Source§

fn worktree_add( &self, repo: &RepoRef, path: &Path, opts: &WorktreeAddOptions, ) -> Result<Worktree>

Adds a linked worktree at path (git worktree add), on the branch or commit WorktreeAddOptions names, optionally on a new branch created there, and returns its entry as GitBackend::worktrees would list it. Read more
Source§

fn worktree_changes( &self, repo: &RepoRef, path: &Path, ) -> Result<Vec<WorktreeChange>>

The uncommitted changes of the worktree at path (tracked and untracked, not ignored), in path order. Empty when it is clean.
Source§

fn worktree_remove( &self, repo: &RepoRef, path: &Path, opts: &WorktreeRemoveOptions, ) -> Result<WorktreeRemoved>

Removes the linked worktree at path (git worktree remove). Read more
Source§

fn patch_apply(&self, repo: &RepoRef, patch: &Path) -> Result<PatchApplied>

Applies patch (a file on disk, in git apply’s format) to the working tree only - never the index - via git apply. Read more
Source§

fn apply_commit_to_worktree( &self, repo: &RepoRef, commit: Oid, ) -> Result<PatchApplied>

Replays the changes commit made (its diff against its parent, or against the empty tree for a root commit) onto the working tree only - never the index, never HEAD. Binary files and line endings come out as in the commit. Read more
Source§

fn merge( &self, repo: &RepoRef, from: &Ref, opts: &MergeOptions, ) -> Result<MergeOutcome>

Source§

fn rebase( &self, repo: &RepoRef, onto: &Ref, opts: &RebaseOptions, ) -> Result<RebaseOutcome>

Source§

fn rebase_plan( &self, repo: &RepoRef, upstream: Option<Oid>, ) -> Result<RebasePlanDraft>

The range an interactive rebase from upstream would replay, oldest first - what a frontend builds an InteractiveRebase plan’s steps from. upstream: None means the whole history (--root). A read.
Source§

fn rebase_interactive( &self, repo: &RepoRef, req: &InteractiveRebase, ) -> Result<RebaseOutcome>

Runs an interactive rebase from an explicit, pre-decided todo list rather than an interactively edited one - the plan a frontend built (possibly from GitBackend::rebase_plan), validated again here regardless. Read more
Source§

fn rebase_continue(&self, repo: &RepoRef) -> Result<RebaseOutcome>

Resumes a rebase stopped by a conflict or an edit step (git rebase --continue). crate::Error::RebaseRefused with crate::domain::RebaseRefusal::NoRebaseInProgress if none is running.
Source§

fn rebase_skip(&self, repo: &RepoRef) -> Result<RebaseOutcome>

Skips the commit a rebase is stopped at (git rebase --skip).
Source§

fn rebase_abort(&self, repo: &RepoRef) -> Result<()>

Aborts a rebase in progress, restoring the branch and HEAD to where they were before it started (git rebase --abort).
Source§

fn cherry_pick( &self, repo: &RepoRef, commits: &[Oid], opts: &CherryPickOptions, ) -> Result<CherryPickOutcome>

Source§

fn revert( &self, repo: &RepoRef, commit: Oid, mainline: Option<u32>, ) -> Result<RevertOutcome>

Reverts commit with a new commit. A merge commit needs mainline: the 1-based number of the parent whose side is kept (git revert -m); None on a merge commit is an error.
Source§

fn stash_push( &self, repo: &RepoRef, message: Option<&str>, include_untracked: bool, ) -> Result<Option<StashId>>

None: there was nothing to stash (“No local changes to save”), no stash was made and nothing changed - callers record no undo entry.
Source§

fn stash_push_paths( &self, repo: &RepoRef, message: Option<&str>, paths: &[String], ) -> Result<Option<StashId>>

Stashes only paths (git stash push -- <paths>), leaving every other change where it is. Untracked files among paths are stashed too (they were asked for by name). An empty paths stashes everything, untracked files included.
Source§

fn stash_pop(&self, repo: &RepoRef, id: StashId) -> Result<()>

Source§

fn stash_apply(&self, repo: &RepoRef, id: StashId) -> Result<()>

Source§

fn stash_drop(&self, repo: &RepoRef, id: StashId) -> Result<()>

Source§

fn stash_store(&self, repo: &RepoRef, commit: Oid, message: &str) -> Result<()>

Puts the stash commit commit back on the stash list, at stash@{0} (git stash store -m <message>): how an undone drop or pop gets its stash back, with the very same commit. commit must be a stash commit (a merge of the base, the index and, maybe, the untracked files); anything else is an error and changes nothing.
Source§

fn stash_from_commit( &self, repo: &RepoRef, commit: Oid, message: Option<&str>, ) -> Result<Oid>

Builds a stash holding exactly the changes commit made (against its first parent, or the empty tree for a root commit) and puts it on top of the stash list, as git stash store would. The working tree, index and HEAD are not touched. message defaults to a text naming the commit. Returns the stash commit.
Source§

fn stash_paths(&self, repo: &RepoRef, commit: Oid) -> Result<Vec<String>>

The repo-relative paths the stash commit commit holds changes for, untracked files included, sorted: what applying or popping it can touch. A read.
Source§

fn remote_add(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()>

Source§

fn remote_remove(&self, repo: &RepoRef, name: &str) -> Result<()>

Removes a remote (git remote remove) together with its remote-tracking branches and its tag mirror. On a leftover name (see GitBackend::leftover_remotes) there is no config to remove, so it deletes just those refs, never a configured sibling’s (<name>/sub); a name that is neither is “no such remote”.
Source§

fn leftover_remotes(&self, repo: &RepoRef) -> Result<Vec<String>>

The remote-tracking namespaces no remote is configured for: refs under refs/remotes/<name>/ (or a tag mirror under crate::domain::REMOTE_TAG_MIRROR_PREFIX) whose <name> is not in GitBackend::remotes - what a repository keeps after its remote went (a fork that is not one any more). Names split like crate::domain::split_remote_ref does (a configured grp/sub owns its refs; the rest of grp/ is the leftover grp), sorted. GitBackend::remote_remove on such a name deletes those refs.
Source§

fn lfs_status(&self, repo: &RepoRef) -> Result<LfsRepoStatus>

What is known about Git LFS in this repository: the git-lfs program’s availability, whether the repository routes files through it, the tracked patterns, and whether its filters and hook are installed. Read more
Source§

fn rewrite_tools(&self, repo: &RepoRef, fresh: bool) -> Result<RewriteTools>

Which external programs a history rewrite could use here (gpg, ssh-keygen, gpgsm, git-lfs, python, shells) and whether each works, with the install hint key for this OS. The core rewrite actions need none of them (see RuleKind::required_tools) and the embedded Lua is always there. Cached for a minute; fresh re-asks (the “Check again” button). Runs programs: never call it on a render thread. A read that never fails because a tool is missing.
Source§

fn rewrite_check_signing(&self, repo: &RepoRef) -> Result<SigningCheck>

Signs a dummy payload once with the repository’s signing setup (gpg.format, user.signingkey, gpg.*.program) and verifies it: the “Check signing” smoke test before a run that re-signs. May open a passphrase prompt. A broken setup is an Ok check with a reason, not an error. Runs programs: never on a render thread.
Source§

fn lfs_install(&self, repo: &RepoRef, scope: LfsInstallScope) -> Result<()>

git lfs install: the clean / smudge filters and the LFS hooks, for this repository only (Repository, the default: --local) or the user’s global git config (User). Needs the git-lfs program: crate::Error::LfsUnavailable otherwise, with nothing changed.
Source§

fn lfs_track( &self, repo: &RepoRef, patterns: &[String], opts: &LfsTrackOptions, ) -> Result<Vec<LfsPattern>>

Routes patterns through LFS (git lfs track). Writes .gitattributes and leaves it unstaged, a visible working change. Returns every LFS pattern of the repository afterwards. With opts.renormalize the already-committed files that match are re-staged so their next commit stores pointers.
Source§

fn lfs_untrack( &self, repo: &RepoRef, patterns: &[String], ) -> Result<Vec<LfsPattern>>

Stops routing patterns through LFS (git lfs untrack). Returns the LFS patterns left.
Source§

fn lfs_prune(&self, repo: &RepoRef) -> Result<()>

git lfs prune: delete old, already-pushed objects from the local LFS store.
Source§

fn unresolve_conflict( &self, repo: &RepoRef, path: &Path, entry: &ConflictEntry, ) -> Result<()>

Puts a resolved path back in conflict: the stage 1/2/3 entries of entry return to the index (stage 0 goes) and the working tree file is rewritten the way git leaves it (the merge with conflict markers; the surviving side for a non-text conflict). Refused with crate::domain::ConflictRefusal::AlreadyConflicted when the path is still unmerged.
Source§

fn operation_state(&self, repo: &RepoRef) -> Result<Option<OperationState>>

The merge, cherry-pick, revert or rebase in progress, if any (rebase wins when several markers exist).
Source§

fn operation_abort(&self, repo: &RepoRef) -> Result<()>

Abandons whatever GitBackend::operation_state reports (merge/cherry-pick/revert/rebase --abort): HEAD, the index and the working tree return to before the operation. Destructive for work done since. Without an operation: refused with crate::domain::ConflictRefusal::NoOperation.
Source§

fn am_continue(&self, repo: &RepoRef) -> Result<AmOutcome>

git am --continue: applies the patch the am stopped on (the caller resolved and staged it) and the rest. Without an am in progress: refused with crate::domain::ConflictRefusal::NoOperation.
Source§

fn am_skip(&self, repo: &RepoRef) -> Result<AmOutcome>

git am --skip: drops the patch the am stopped on and goes on. Same refusal as GitBackend::am_continue.
Source§

fn am_abort(&self, repo: &RepoRef) -> Result<()>

git am --abort: back to the branch tip from before the am. Same refusal as GitBackend::am_continue.
Source§

fn index_lock(&self, repo: &RepoRef) -> Result<Option<IndexLock>>

The repository’s index.lock, if the file exists. In a linked worktree it is the worktree’s own (.git/worktrees/<name>).
Source§

fn index_lock_remove(&self, repo: &RepoRef) -> Result<()>

Deletes a stale index.lock (and nothing else). Refused with an error when there is none, or when it is younger than crate::domain::STALE_INDEX_LOCK_SECS.
Source§

fn operation_skip(&self, repo: &RepoRef) -> Result<()>

Skips what GitBackend::operation_state reports (cherry-pick --skip, revert --skip, rebase --skip): the stopped commit is given up on and HEAD, the index and the working tree return to HEAD. The way out of a pick or revert that became empty (the change is already applied; git refuses to commit it). A merge has nothing to skip: an Error::Backend, nothing changed. Without an operation: crate::domain::ConflictRefusal::NoOperation.
Source§

fn config_sections( &self, repo: &RepoRef, sections: &[String], ) -> Result<Vec<(String, Vec<(String, String)>)>, Error>

GitBackend::config_section for several sections at once, in the order asked. The system-git backend answers with one process instead of one per section (the undo journal reads a remote’s section and every dependent branch’s together).

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.

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

Source§

impl<T> MaybeSync for T

Source§

impl<T> Same for T

Source§

type Output = T

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

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.