Skip to main content

GitStateRecord

Enum GitStateRecord 

Source
pub enum GitStateRecord<'a> {
    Head {
        flags: u8,
        oid: GitOid,
        name: &'a str,
    },
    Ref {
        flags: u8,
        oid: GitOid,
        peeled: GitOid,
        name: &'a str,
        target: &'a str,
    },
    Op {
        op: u8,
        oid: GitOid,
        detail: &'a str,
    },
    Status {
        staged: u8,
        unstaged: u8,
        flags: u8,
        oid: GitOid,
        old_path: &'a str,
        path: &'a str,
    },
    Upstream {
        flags: u8,
        ahead: u32,
        behind: u32,
        name: &'a str,
        upstream: &'a str,
    },
    Stash {
        index: u16,
        oid: GitOid,
        time: i64,
        tz: i16,
        msg: &'a str,
    },
    Remote {
        flags: u8,
        name: &'a str,
        fetch_url: &'a str,
        push_url: &'a str,
    },
}
Expand description

One decoded record from a GIT_STATE payload.

Variants§

§

Head

HEAD 0x01: [kind:1][flags:1][oid:32][name_len:2][name:N] name is the symbolic target (empty when detached).

Fields

§flags: u8
§name: &'a str
§

Ref

STATE_REF 0x02: [kind:1][flags:1][oid:32][peeled:32][name_len:2][name:N][target_len:2][target:N] target is the symbolic target’s full ref name when SYMBOLIC, else empty — so refs/remotes/origin/HEAD names the default branch instead of only peeling to its oid.

Fields

§flags: u8
§peeled: GitOid
§name: &'a str
§target: &'a str
§

Op

OP 0x03: [kind:1][op:1][oid:32][detail_len:2][detail:N] oid is the operation head; an absent record means no operation.

Fields

§op: u8
§detail: &'a str
§

Status

STATUS 0x04: [kind:1][staged:1][unstaged:1][flags:1][oid:32][old_len:2][old_path:N][path_len:2][path:N] staged/unstaged are porcelain letters (ASCII AMDRTU, ?, !); old_path is non-empty only for renames.

oid is the worktree content’s hash when the status walk read the file, else zero. Without it a write that leaves a file’s letters unchanged — an agent editing the same file over and over — produces a byte-identical snapshot, which the engine suppresses, so the server knows the worktree moved and has no way to say so. With it the existing dedupe does the right thing and no new concept is needed.

Fields

§staged: u8
§unstaged: u8
§flags: u8
§old_path: &'a str
§path: &'a str
§

Upstream

UPSTREAM 0x05: [kind:1][flags:1][ahead:4][behind:4][name_len:2][name:N][upstream_len:2][upstream:N] One per local branch with a configured upstream; name joins Ref records by ref name.

Fields

§flags: u8
§ahead: u32
§behind: u32
§name: &'a str
§upstream: &'a str
§

Stash

STASH 0x06: [kind:1][index:2][oid:32][time:8 i64 s][tz:2 i16 min][msg_len:2][msg:N] index is the N of stash@{N}, oid the stash commit.

Fields

§index: u16
§time: i64
§tz: i16
§msg: &'a str
§

Remote

STATE_REMOTE 0x07: [kind:1][flags:1][name_len:2][name:N][fetch_len:2][fetch_url:N][push_len:2][push_url:N] One per configured remote, with the REMOTES open flag. URLs go out as configured, userinfo included: the caller already has a shell and can read .git/config, so withholding it would only stop them reproducing the remote. push_url is empty when it equals fetch_url. Not a general config surface: three named fields, no key/value access, no writes.

Fields

§flags: u8
§name: &'a str
§fetch_url: &'a str
§push_url: &'a str

Trait Implementations§

Source§

impl<'a> Clone for GitStateRecord<'a>

Source§

fn clone(&self) -> GitStateRecord<'a>

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<'a> Debug for GitStateRecord<'a>

Source§

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

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

impl<'a> Eq for GitStateRecord<'a>

Source§

impl<'a> PartialEq for GitStateRecord<'a>

Source§

fn eq(&self, other: &GitStateRecord<'a>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for GitStateRecord<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for GitStateRecord<'a>

§

impl<'a> RefUnwindSafe for GitStateRecord<'a>

§

impl<'a> Send for GitStateRecord<'a>

§

impl<'a> Sync for GitStateRecord<'a>

§

impl<'a> Unpin for GitStateRecord<'a>

§

impl<'a> UnsafeUnpin for GitStateRecord<'a>

§

impl<'a> UnwindSafe for GitStateRecord<'a>

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> 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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.