pub struct SystemGitBackend { /* private fields */ }Implementations§
Source§impl SystemGitBackend
impl SystemGitBackend
Sourcepub fn without_lfs() -> Self
pub fn without_lfs() -> Self
A backend that behaves as if git-lfs is not installed, whatever
the machine has: every LFS operation that needs the program fails
with Error::LfsUnavailable. A constructor rather than the
GITPOULPI_GIT_LFS variable so tests running in parallel cannot
affect each other.
Trait Implementations§
Source§impl Default for SystemGitBackend
impl Default for SystemGitBackend
Source§impl GitBackend for SystemGitBackend
impl GitBackend for SystemGitBackend
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Short implementation name (
"git2" or "system"), for diagnostics.Source§fn discover(&self, path: &Path) -> Result<DiscoveredRepo>
fn discover(&self, path: &Path) -> Result<DiscoveredRepo>
Finds the repository enclosing
path and describes it. Read moreSource§fn init(&self, path: &Path, opts: &InitOptions) -> Result<RepoRef>
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 morefn status(&self, repo: &RepoRef) -> Result<WorkingTree>
Source§fn log(&self, repo: &RepoRef, opts: &LogOptions) -> Result<CommitGraph>
fn log(&self, repo: &RepoRef, opts: &LogOptions) -> Result<CommitGraph>
The commit graph. With
all_refs, opts.hidden drops refs from the
walk (the commits only they reach go with them; HEAD always stays
while a filter is active); both backends take the tips from
domain::visible_tips and page that one walk with skip/limit.Source§fn count_commits(&self, repo: &RepoRef, opts: &LogOptions) -> Result<u64>
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 ref_snapshot(&self, repo: &RepoRef, scope: &RefScope) -> Result<RefSnapshot>
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<()>
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 move_head_keep(
&self,
repo: &RepoRef,
branch: &str,
from: Oid,
to: Oid,
) -> Result<()>
fn move_head_keep( &self, repo: &RepoRef, branch: &str, from: Oid, to: Oid, ) -> Result<()>
Moves the branch
branch from from to to and carries the
index and working tree along, with git reset --keep semantics:
local changes survive unless the move would overwrite them, in
which case it is UndoRefusal::WouldOverwrite and nothing changed.
branch must be the checked-out branch (else HeadMoved) and must
hold from (else RefMoved). The undo journal’s primitive for
fast-forwards of the checked-out branch.Source§fn index_tree(&self, repo: &RepoRef) -> Result<Oid>
fn index_tree(&self, repo: &RepoRef) -> Result<Oid>
The tree id of the index as it is right now (
git write-tree):
what a staging operation’s undo records before and after. Writes
tree objects (never the working tree); an index with unresolved
conflicts has no tree and is an error.Source§fn index_restore(&self, repo: &RepoRef, tree: Oid) -> Result<()>
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_create(&self, repo: &RepoRef, paths: &[String]) -> Result<Snapshot>
fn snapshot_create(&self, repo: &RepoRef, paths: &[String]) -> Result<Snapshot>
A safety snapshot of every file under
paths (repo-relative, /
separated; a directory means everything below it): the index entry
and the working-tree file, including untracked files, as raw
bytes (no clean filter), with the executable bit and symlinks. It
writes objects only: neither the index nor the working tree is
touched. Take it before a destructive operation and keep tree
reachable with a pin ref. Snapshot only what the operation will
touch, never the whole tree.Source§fn snapshot_restore(
&self,
repo: &RepoRef,
snapshot: Oid,
paths: &[String],
) -> Result<()>
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>>
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>>
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>
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 lost_commits(
&self,
repo: &RepoRef,
opts: &LostCommitOptions,
) -> Result<LostCommitsPage>
fn lost_commits( &self, repo: &RepoRef, opts: &LostCommitOptions, ) -> Result<LostCommitsPage>
Commits no branch, tag, remote-tracking ref or stash reaches (the
reflogs and GitPoulpi’s undo pins do not count as reaching), newest
first: what a deleted branch left behind (named by a reflog or only
by an undo pin), and with
opts.deep the dangling commits of the
whole object database (what git fsck --unreachable --no-reflogs
lists). A read, bounded by opts.budget_ms.Source§fn delete_files(&self, repo: &RepoRef, paths: &[String]) -> Result<()>
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 convert_files(
&self,
repo: &RepoRef,
paths: &[String],
op: ConvertOp,
) -> Result<ConvertReport>
fn convert_files( &self, repo: &RepoRef, paths: &[String], op: ConvertOp, ) -> Result<ConvertReport>
Rewrites the bytes of the files
paths (working tree only; the index
is not touched) as op says: another encoding, other line breaks or
other indentation (textconv::convert_bytes, the editor’s own
functions). A binary file, a missing one, one the target encoding
cannot hold, is left alone and reported, never damaged; a path
outside the repository or inside .git is an error. The daemon-side
home of the right pane’s “Convert” menu, so one call is one journal
entry.Source§fn gitignore_add(
&self,
repo: &RepoRef,
pattern: &str,
file: Option<&str>,
) -> Result<bool>
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 gitattributes_treat(
&self,
repo: &RepoRef,
paths: &[String],
scope: RuleScope,
file: Option<&str>,
treat: Treat,
) -> Result<AttributesWrite>
fn gitattributes_treat( &self, repo: &RepoRef, paths: &[String], scope: RuleScope, file: Option<&str>, treat: Treat, ) -> Result<AttributesWrite>
Writes the
.gitattributes rule that makes git diff paths as
treat says (see crate::domain::Treat::attributes): one pattern
per path (scope: the file itself or its extension; Folder: the
path is a folder and the rule covers everything below), relative to
file’s folder. file is repo-relative: None is the root
.gitattributes, Some(".git/info/attributes") the per-clone file,
else a .gitattributes inside the repository (created when
missing). A rule already naming the same pattern is rewritten rather
than contradicted. The answer says what was written and whether git
now really treats paths that way (a rule closer to the file, or
in .git/info/attributes, can still override a root one). The
daemon-side home of “Treat as Binary/Text”, journaled like
GitBackend::gitignore_add, except for the per-clone file, which
lives outside the working tree.Source§fn mailmap_resolve(
&self,
repo: &RepoRef,
idents: &[Ident],
) -> Result<Vec<Ident>>
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 mailmap_identities(
&self,
repo: &RepoRef,
scope: &Scope,
options: &ScopeOptions,
) -> Result<IdentityList>
fn mailmap_identities( &self, repo: &RepoRef, scope: &Scope, options: &ScopeOptions, ) -> Result<IdentityList>
Every name and email that authored or committed a commit of
scope,
with the counts, most commits first, and what the .mailmap already
maps each to. The Identities list of the history workbench. A read;
one git log, whatever the size of the history.Source§fn mailmap_add(
&self,
repo: &RepoRef,
canonical: &Ident,
from: &[Ident],
file: Option<&str>,
) -> Result<MailmapAdded>
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 binary_paths(&self, repo: &RepoRef, paths: &[String]) -> Result<Vec<bool>>
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 patch_files(&self, repo: &RepoRef, patch: &Path) -> Result<Vec<String>>
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 config_section(
&self,
repo: &RepoRef,
section: &str,
) -> Result<Vec<(String, String)>>
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 config_sections(
&self,
repo: &RepoRef,
sections: &[String],
) -> Result<Vec<ConfigSection>>
fn config_sections( &self, repo: &RepoRef, sections: &[String], ) -> Result<Vec<ConfigSection>>
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).Source§fn remote_dependents(&self, repo: &RepoRef, remote: &str) -> Result<Vec<String>>
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<()>
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.fn diff(&self, repo: &RepoRef, target: DiffTarget) -> Result<Vec<FileDiff>>
Source§fn diff_files(&self, repo: &RepoRef, target: DiffTarget) -> Result<DiffFileList>
fn diff_files(&self, repo: &RepoRef, target: DiffTarget) -> Result<DiffFileList>
Source§fn commit_stats(&self, repo: &RepoRef, ids: &[Oid]) -> Result<Vec<CommitStat>>
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>
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>>
fn diff_paths( &self, repo: &RepoRef, target: DiffTarget, paths: &[PathBuf], ) -> Result<Vec<FileDiff>>
fn refs(&self, repo: &RepoRef) -> Result<Vec<Ref>>
fn stashes(&self, repo: &RepoRef) -> Result<Vec<Stash>>
fn remotes(&self, repo: &RepoRef) -> Result<Vec<Remote>>
Source§fn leftover_remotes(&self, repo: &RepoRef) -> Result<Vec<String>>
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 worktrees(&self, repo: &RepoRef) -> Result<Vec<Worktree>>
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>>
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 submodule_init(&self, repo: &RepoRef, paths: &[String]) -> Result<()>
fn submodule_init(&self, repo: &RepoRef, paths: &[String]) -> Result<()>
Registers submodules in
.git/config (git submodule init), without
cloning anything. Empty paths is every submodule; an unknown path is
an error.Source§fn submodule_update(
&self,
repo: &RepoRef,
opts: &SubmoduleUpdateOptions,
) -> Result<()>
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 merge_base(&self, repo: &RepoRef, a: Oid, b: Oid) -> Result<Option<Oid>>
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)>
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)>
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>>
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 moreSource§fn read_blob(
&self,
repo: &RepoRef,
path: &Path,
source: &BlobSource,
) -> Result<Blob>
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 moreSource§fn read_blob_bytes(
&self,
repo: &RepoRef,
path: &Path,
source: &BlobSource,
max: u64,
) -> Result<BlobBytes>
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 moreSource§fn list_tree(&self, repo: &RepoRef, at: Oid) -> Result<Vec<PathBuf>>
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 moreSource§fn grep_tree(
&self,
repo: &RepoRef,
at: Oid,
terms: &[String],
max_hits: usize,
) -> Result<Vec<GrepHit>>
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 moreSource§fn file_history(
&self,
repo: &RepoRef,
path: &Path,
start: Oid,
skip: usize,
limit: usize,
) -> Result<FileHistoryPage>
fn file_history( &self, repo: &RepoRef, path: &Path, start: Oid, skip: usize, limit: usize, ) -> Result<FileHistoryPage>
The commits that changed
path, newest first, following renames
(git log --follow), starting from start and returning at most
limit entries after skipping skip. Read morefn stage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()>
fn unstage(&self, repo: &RepoRef, target: &StageTarget) -> Result<()>
fn commit( &self, repo: &RepoRef, message: &str, opts: &CommitOptions, ) -> Result<Oid>
fn checkout(&self, repo: &RepoRef, target: &CheckoutTarget) -> Result<()>
Source§fn discard(&self, repo: &RepoRef, paths: &[String]) -> Result<()>
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 moreSource§fn discard_part(&self, repo: &RepoRef, target: &DiscardTarget) -> Result<()>
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 morefn branch_create(&self, repo: &RepoRef, name: &str, at: Oid) -> Result<()>
Source§fn branch_create_tracking(
&self,
repo: &RepoRef,
local_name: &str,
upstream: &str,
) -> Result<()>
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 morefn branch_delete(&self, repo: &RepoRef, name: &str) -> Result<()>
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<()>
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 moreSource§fn fast_forward(
&self,
repo: &RepoRef,
branch: &str,
target: Oid,
) -> Result<FastForwardOutcome>
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 moreSource§fn worktree_add(
&self,
repo: &RepoRef,
path: &Path,
opts: &WorktreeAddOptions,
) -> Result<Worktree>
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 moreSource§fn worktree_changes(
&self,
repo: &RepoRef,
path: &Path,
) -> Result<Vec<WorktreeChange>>
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>
fn worktree_remove( &self, repo: &RepoRef, path: &Path, opts: &WorktreeRemoveOptions, ) -> Result<WorktreeRemoved>
Source§fn patch_create(
&self,
repo: &RepoRef,
source: &PatchSource,
dest: &Path,
) -> Result<PatchCreated>
fn patch_create( &self, repo: &RepoRef, source: &PatchSource, dest: &Path, ) -> Result<PatchCreated>
Writes
source out as a patch file at dest (git format-patch
for commits/ranges, git diff HEAD --binary for the working
tree). Read moreSource§fn patch_apply(&self, repo: &RepoRef, patch: &Path) -> Result<PatchApplied>
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 moreSource§fn apply_commit_to_worktree(
&self,
repo: &RepoRef,
commit: Oid,
) -> Result<PatchApplied>
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 morefn tag_create( &self, repo: &RepoRef, name: &str, at: Oid, annotated_message: Option<&str>, ) -> Result<()>
fn tag_delete(&self, repo: &RepoRef, name: &str) -> Result<()>
Source§fn tag_annotate(&self, repo: &RepoRef, name: &str, message: &str) -> Result<()>
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 moreSource§fn tag_move(
&self,
repo: &RepoRef,
name: &str,
to: Oid,
force: bool,
) -> Result<()>
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 moreSource§fn tag_merge_branch(
&self,
repo: &RepoRef,
name: &str,
branch: &str,
message: Option<&str>,
) -> Result<Oid>
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 moreSource§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,
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,
Sends tags to
remote - one named tag, several, or every tag no
remote is known to have (see crate::domain::TagSelection). Read moreSource§fn tag_take_remote(
&self,
repo: &RepoRef,
remote: &str,
name: &str,
) -> Result<()>
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,
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,
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,
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,
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,
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,
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,
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.fn merge( &self, repo: &RepoRef, from: &Ref, opts: &MergeOptions, ) -> Result<MergeOutcome>
fn rebase( &self, repo: &RepoRef, onto: &Ref, opts: &RebaseOptions, ) -> Result<RebaseOutcome>
Source§fn rebase_plan(
&self,
repo: &RepoRef,
upstream: Option<Oid>,
) -> Result<RebasePlanDraft>
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>
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 moreSource§fn rebase_state(&self, repo: &RepoRef) -> Result<Option<RebaseState>>
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 rebase_continue(&self, repo: &RepoRef) -> Result<RebaseOutcome>
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>
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<()>
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).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>
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.fn reset(&self, repo: &RepoRef, target: Oid, mode: ResetMode) -> Result<()>
Source§fn amend_commit(
&self,
repo: &RepoRef,
commit: Oid,
amend: &CommitAmend,
) -> Result<RewordOutcome>
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_source(&self, repo: &RepoRef, commit: Oid) -> Result<SplitSource>
fn split_source(&self, repo: &RepoRef, commit: Oid) -> Result<SplitSource>
The pieces
commit can be split into, numbered with --no-renames
(never from diff(CommitVsParent), which honours diff.renames).
Text-modified files list hunks; binary, mode-only, added, deleted,
submodule and LFS files are whole-only. A read.Source§fn split_commit(
&self,
repo: &RepoRef,
req: &SplitCommit,
) -> Result<SplitOutcome>
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>
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>
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>
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>>
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>
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>
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,
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>
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>
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>
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 moreSource§fn rewrite_script_test(
&self,
repo: &RepoRef,
script: &ScriptRef,
policy: &ScriptPolicy,
commits: &[Oid],
) -> Result<Vec<ScriptTestRow>>
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_scan_secrets(
&self,
repo: &RepoRef,
scope: &Scope,
progress: RewriteProgressSink<'_>,
) -> Result<SecretScan>
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_analyze(
&self,
repo: &RepoRef,
scope: &Scope,
top: u32,
progress: RewriteProgressSink<'_>,
) -> Result<SizeAnalysis>
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_discard(&self, repo: &RepoRef, run: &RunId) -> Result<()>
fn rewrite_discard(&self, repo: &RepoRef, run: &RunId) -> Result<()>
Deletes a preview’s temporary objects. Idempotent.
Source§fn stash_push(
&self,
repo: &RepoRef,
message: Option<&str>,
include_untracked: bool,
) -> Result<Option<StashId>>
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>>
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.fn stash_pop(&self, repo: &RepoRef, id: StashId) -> Result<()>
fn stash_apply(&self, repo: &RepoRef, id: StashId) -> Result<()>
fn stash_drop(&self, repo: &RepoRef, id: StashId) -> Result<()>
Source§fn stash_store(&self, repo: &RepoRef, commit: Oid, message: &str) -> Result<()>
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>
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>>
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 set_network_auth(&self, repo: &RepoRef, auth: Option<NetworkAuth>)
fn set_network_auth(&self, repo: &RepoRef, auth: Option<NetworkAuth>)
Sets (or, with
None, removes) how the network git processes of
repo authenticate: they get auth instead of the process-wide
credential mode and SSH key (ADR-0010). Held in memory, per
repository, never persisted; no entry means the unchanged behaviour.
Not a repository mutation: not journaled, not undoable. Git2Backend
forwards it to its system-git fallback, which does all networking.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,
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.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,
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 moreSource§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,
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 moreSource§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,
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,
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 moreSource§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,
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,
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,
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 moreSource§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,
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.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 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,
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,
fn remote_add(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()>
Source§fn remote_remove(&self, repo: &RepoRef, name: &str) -> Result<()>
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 remote_rename(
&self,
repo: &RepoRef,
old_name: &str,
new_name: &str,
) -> Result<()>
fn remote_rename( &self, repo: &RepoRef, old_name: &str, new_name: &str, ) -> Result<()>
Renames a remote (
git remote rename): its config section, its
remote-tracking branches, every local branch’s upstream that named
it, and its tag mirror under
crate::domain::REMOTE_TAG_MIRROR_PREFIX - or every tag it had
would read as unpushed until the next fetch.Source§fn remote_set_url(&self, repo: &RepoRef, name: &str, url: &str) -> Result<()>
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<()>
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>>
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<()>
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>>
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>
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<()>
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<()>
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<()>
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)>>
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 rewrite_tools(&self, repo: &RepoRef, fresh: bool) -> Result<RewriteTools>
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>
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_status(&self, repo: &RepoRef) -> Result<LfsRepoStatus>
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 moreSource§fn lfs_files(&self, repo: &RepoRef, at: Option<Oid>) -> Result<Vec<LfsFile>>
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_install(&self, repo: &RepoRef, scope: LfsInstallScope) -> Result<()>
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>>
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>>
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<()>
fn lfs_prune(&self, repo: &RepoRef) -> Result<()>
git lfs prune: delete old, already-pushed objects from the local
LFS store.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,
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,
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,
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,
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,
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,
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,
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.fn conflicts(&self, repo: &RepoRef) -> Result<Vec<ConflictSet>>
Source§fn conflict_entries(&self, repo: &RepoRef) -> Result<Vec<ConflictEntry>>
fn conflict_entries(&self, repo: &RepoRef) -> Result<Vec<ConflictEntry>>
Every unmerged path with its stages’ modes and oids and the kind of
conflict they make, sorted by path. Reads no blob (the cheap form of
GitBackend::conflicts, for the refresh): 1 spawn on system git,
none under git2. Empty when nothing is unmerged.Source§fn merge_document(&self, repo: &RepoRef, path: &Path) -> Result<MergeDocument>
fn merge_document(&self, repo: &RepoRef, path: &Path) -> Result<MergeDocument>
Everything the merge conflict editor needs for one unmerged
path:
the three stages read, git’s own 3-way merge of them parsed into
regions (see MergeDocument), the pane labels and the state of
the file on disk. Text is decoded as read_blob does (the fallback
encoding applies). A path that is not unmerged is an error.Source§fn resolve_conflict(
&self,
repo: &RepoRef,
path: &Path,
resolution: ConflictResolution,
opts: &ResolveOptions,
) -> Result<()>
fn resolve_conflict( &self, repo: &RepoRef, path: &Path, resolution: ConflictResolution, opts: &ResolveOptions, ) -> Result<()>
Resolves the unmerged
path as resolution says and, with
opts.stage, stages the result. Refused (nothing written) with
crate::domain::ConflictRefusal::Stale when opts.expected is
not what the index holds, and
crate::domain::ConflictRefusal::Unencodable for text a
UseEncoded encoding cannot hold. A path that is not conflicted is
written and staged like any file unless expected is given (then
it is stale).Source§fn unresolve_conflict(
&self,
repo: &RepoRef,
path: &Path,
entry: &ConflictEntry,
) -> Result<()>
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>>
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<()>
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>
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>
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 index_lock(&self, repo: &RepoRef) -> Result<Option<IndexLock>>
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<()>
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<()>
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.Auto Trait Implementations§
impl !Freeze for SystemGitBackend
impl Forget for SystemGitBackend
impl Move for SystemGitBackend
impl RefUnwindSafe for SystemGitBackend
impl Send for SystemGitBackend
impl Sync for SystemGitBackend
impl Unpin for SystemGitBackend
impl UnsafeUnpin for SystemGitBackend
impl UnwindSafe for SystemGitBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more