Skip to main content

ReceivePack

Struct ReceivePack 

Source
pub struct ReceivePack<'a> { /* private fields */ }
Expand description

The server side of git-receive-pack.

Implementations§

Source§

impl<'a> ReceivePack<'a>

Source

pub fn new(git: &'a dyn GitServe, hash_kind: Kind) -> Self

Receive into git with default configuration.

Source

pub fn with_config(self, config: Config) -> Self

Replace the configuration.

Source

pub fn hash_kind(&self) -> Kind

The repository’s hash kind.

Source

pub fn write_ref_advertisement(&self, out: &mut dyn Write) -> Result<()>

Write the reference advertisement and its capabilities.

Source

pub fn serve( &self, input: &mut dyn BufRead, out: &mut dyn Write, ingest: &dyn PackIngest, gate: &dyn PushGate, ) -> Result<Option<PushOutcome>>

Serve one push, from the advertisement through the status report.

Source

pub fn serve_session( &self, session: Session, input: &mut dyn BufRead, out: &mut dyn Write, ingest: &dyn PackIngest, gate: &dyn PushGate, ) -> Result<Option<PushOutcome>>

Serve one push for either Session.

Push is the easy half of stateless-rpc, and it is worth saying why. receive-pack has no negotiation: the client is told the refs once, and then sends its command list, its options and its packfile in one go. So a smart-HTTP push is exactly one POST and the only difference from SSH is that the advertisement was a separate GET. There is no round to cut short here, and protocol v2 has no push side to complicate it.

Source

pub fn write_empty_advertisement( hash_kind: Kind, config: &Config, out: &mut dyn Write, ) -> Result<()>

The advertisement of a repository that does not exist yet: no references, the capabilities and object-format of hash_kind. The first-repository door writes this instead of Self::write_ref_advertisement because there is no store to snapshot — and must not be one, until the client has sent a command that passes the hash check.

Source

pub fn read_preamble( hash_kind: Kind, input: &mut dyn BufRead, ) -> Result<Option<Preamble>>

The client’s half of the opening: its command list and capabilities, with the hash check applied. None when the client took the advertisement and sent nothing, which is git push with nothing to do — and a sha1 working tree that read object-format=sha256 and gave up . Neither is an error and neither is a push.

An associated function, not a method: the first-repository door calls it before any store exists, so it must not need one.

Source

pub fn serve_after_preamble( &self, preamble: Preamble, input: &mut dyn BufRead, out: &mut dyn Write, ingest: &dyn PackIngest, gate: &dyn PushGate, ) -> Result<PushOutcome>

Serve a push whose Preamble has been read: options, the pack, the gates, the ref updates and the status report.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ReceivePack<'a>

§

impl<'a> !UnwindSafe for ReceivePack<'a>

§

impl<'a> Freeze for ReceivePack<'a>

§

impl<'a> Send for ReceivePack<'a>

§

impl<'a> Sync for ReceivePack<'a>

§

impl<'a> Unpin for ReceivePack<'a>

§

impl<'a> UnsafeUnpin for ReceivePack<'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> 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, 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