pub enum RepoTarget {
Local {
workdir: PathBuf,
},
Remote {
endpoint: RemoteEndpoint,
workdir: PathBuf,
},
Container {
container: ContainerId,
workdir: PathBuf,
},
}Expand description
Where a Git query runs. Exactly three real backends exist (0036, 0037); there is deliberately no provider trait behind them.
Variants§
Local
A worktree on this machine: libgit2 and local git apply.
Remote
A worktree on endpoint. The workdir names a path on the
remote host — it is never a valid local path, and no libgit2
handle may be opened against it.
Container
A worktree inside a running container on the local engine. The workdir names a path inside the container — it is never a valid local path, and no libgit2 handle may be opened against it. Identity is the canonical 64-hex inspect id: a stopped or restarted container’s reads fail typed at the engine boundary.
Implementations§
Source§impl RepoTarget
impl RepoTarget
Sourcepub fn workdir(&self) -> &Path
pub fn workdir(&self) -> &Path
The repository root as native bytes — locally openable only for
RepoTarget::Local; a remote or container workdir names a path
on another filesystem namespace. Callers that need to open it
must match on the variant first.
Sourcepub fn remote_file(&self, rel: &Path) -> Option<RemoteFile>
pub fn remote_file(&self, rel: &Path) -> Option<RemoteFile>
The remote-file identity for a repo-relative path (SSH-remote repositories only): endpoint plus native path, the identity an open request routes by. Local and container repositories have no remote file.
Sourcepub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
true only for an SSH-remote repository. A container repository
is not remote in this sense — it has no endpoint and rides the
local engine — but it is not local either: callers deciding “can
I open this path” must not treat !is_remote() as local.
Sourcepub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
true for a container repository: not locally openable even
though it shares this machine’s engine.
Sourcepub fn rel_of(&self, path: &Path) -> Option<PathBuf>
pub fn rel_of(&self, path: &Path) -> Option<PathBuf>
Repo-relative path for a path inside this repository — the
remote flavor strips the remote workdir. None is the typed
refusal for a path that is not inside the repository at all.
Sourcepub fn abs_of(&self, rel: &Path) -> PathBuf
pub fn abs_of(&self, rel: &Path) -> PathBuf
The absolute path of a repo-relative path on the machine this repository lives on.
pub fn endpoint(&self) -> Option<&RemoteEndpoint>
Trait Implementations§
Source§impl Clone for RepoTarget
impl Clone for RepoTarget
Source§fn clone(&self) -> RepoTarget
fn clone(&self) -> RepoTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more