Skip to main content

UnnameableRef

Struct UnnameableRef 

Source
pub struct UnnameableRef {
    pub name: Vec<u8>,
    pub reason: String,
    pub position: usize,
    pub deletes: bool,
}
Expand description

A command line this server will not accept a name from.

§Why an invalid name is not an error

It used to be. read_commands called FullName::new with ?, so one bad name aborted the whole session before the pack had been read: the client was still writing and got a broken pipe, no report-status was ever produced, and every other reference in the same push was lost with no line saying which one was at fault. That is the the remote end hung up unexpectedly shape, and it is the same defect the shallow-clone fix in read_commands closed for one particular cause without closing the class.

Stock git defers it to the report, and this is measured, not assumed. git receive-pack 2.53.0, 2026-08-06, fed a raw two-command push of refs/heads/goodone and refs/heads/bad~name over one connection, answered:

unpack ok
ok refs/heads/goodone
ng refs/heads/bad~name funny refname

exit 0, refs/heads/goodone created. So the good reference lands, the bad one is named in the report, and the session ends cleanly. gunnar now does the same.

The name is kept as bytes: it is precisely a name the validator refused, so there is nothing to hold it in, and it is echoed back verbatim because a client matches the ng line against the name it sent. Since the contract’s RefRow::name is a String, a name that is valid but not UTF-8 lands here too — see ReceivePack::parse_command, which records that narrowing rather than hiding it.

Fields§

§name: Vec<u8>

The reference name exactly as the client spelled it.

§reason: String

The one-line reason, rendered into the ng line.

§position: usize

Where the line sat in the client’s command list, so the report can be emitted in the order the client sent — which is what git does and what a client zipping its own list against the report needs.

§deletes: bool

Whether the line asked for a deletion. A push carrying only unnameable deletes sends no pack, and a server that waited for one would hang.

Trait Implementations§

Source§

impl Clone for UnnameableRef

Source§

fn clone(&self) -> Self

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 UnnameableRef

Source§

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

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

impl Eq for UnnameableRef

Source§

impl PartialEq for UnnameableRef

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UnnameableRef

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more