Skip to main content

RepoTarget

Enum RepoTarget 

Source
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.

Fields

§workdir: PathBuf
§

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.

Fields

§workdir: PathBuf
§

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.

Fields

§container: ContainerId
§workdir: PathBuf

Implementations§

Source§

impl RepoTarget

Source

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.

Source

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.

Source

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.

Source

pub fn is_container(&self) -> bool

true for a container repository: not locally openable even though it shares this machine’s engine.

Source

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.

Source

pub fn abs_of(&self, rel: &Path) -> PathBuf

The absolute path of a repo-relative path on the machine this repository lives on.

Source

pub fn endpoint(&self) -> Option<&RemoteEndpoint>

Trait Implementations§

Source§

impl Clone for RepoTarget

Source§

fn clone(&self) -> RepoTarget

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RepoTarget

Source§

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

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

impl<'de> Deserialize<'de> for RepoTarget

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for RepoTarget

Source§

impl PartialEq for RepoTarget

Source§

fn eq(&self, other: &RepoTarget) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RepoTarget

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RepoTarget

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.