Skip to main content

Module remote

Module remote 

Source
Expand description

The read-oriented remote Git backend (0036 RW8): bounded git commands against a worktree that exists only on an SSH endpoint, executed through the shared remote-execution boundary and parsed by the same structured parsers as the local backend. No libgit2 here — no remote filesystem is ever assumed local — and no mutation verbs exist on this path at all (RW4 keeps remote repositories read-only).

Every machine-format boundary (ls-tree/ls-files records, rev-parse output, config -z remotes, rev-list --parents) is a pure parser fed by bytes captured from real git, so native — possibly non-UTF-8 — filenames stay worktree identities and exit codes carry the meaning instead of stderr matching. Unborn HEAD and absent paths are honest Nones; transport, tooling and truncation failures are typed errors.

Structs§

FileContents
HEAD’s and the index’s blob bytes for one repo-relative path — the gutter diff’s inputs. head_sha is the context’s resolved HEAD (an unborn repository passes None and HEAD is not asked). Absent from HEAD’s tree / absent from the index are honest Nones.

Enums§

RemoteGitError
Why a remote Git query failed — typed at this boundary, never a bare string and never an empty list standing in for “failed”.

Functions§

commit_file_diff
One file’s structured delta at sha against its first parent (root commits diff against empty): the dive view’s data, built from the two blobs and the same hunk builder the local libgit2 path uses.
context
The pure cached context of a remote repository (R6): HEAD sha, branch and remotes captured once on a worker. Unborn HEAD and detached HEAD are honest None/name states, distinguished by exit code — never by stderr text.
discover
Discover the repository containing a remote directory. Ok(None) is the honest “no repository here” — git’s own not-a-repository fatal — while transport failures, missing git/python3 and corrupt repositories are typed errors. The returned workdir is a path on the endpoint, native bytes, never a local path.
effective_host
Resolve an SSH alias against OpenSSH’s effective configuration on the endpoint (ssh -G run remotely): the alias belongs to the machine whose remote carries it, and evaluating it with the local user’s config would answer for the wrong host. Owned worker work, cancellable like every bounded remote run.
file_contents
One file’s HEAD/index blob bytes via machine-readable presence checks (ls-tree/ls-files, -z, literal pathspec) followed by cat-file on the recorded oid — never a :path spelling whose absence would need stderr matching to interpret.
gutter
Fetch a file’s HEAD and index contents and assemble the gutter’s typed hunk sets against the live buffer text — the same semantics crate::Repo::unstaged_hunks/[staged_hunks]/[is_untracked] give local buffers, from bounded remote reads. Untracked files report one all-add hunk, matching local behavior.