pub struct ReceivePack<'a> { /* private fields */ }Expand description
The server side of git-receive-pack.
Implementations§
Source§impl<'a> ReceivePack<'a>
impl<'a> ReceivePack<'a>
Sourcepub fn new(git: &'a dyn GitServe, hash_kind: Kind) -> Self
pub fn new(git: &'a dyn GitServe, hash_kind: Kind) -> Self
Receive into git with default configuration.
Sourcepub fn with_config(self, config: Config) -> Self
pub fn with_config(self, config: Config) -> Self
Replace the configuration.
Sourcepub fn write_ref_advertisement(&self, out: &mut dyn Write) -> Result<()>
pub fn write_ref_advertisement(&self, out: &mut dyn Write) -> Result<()>
Write the reference advertisement and its capabilities.
Sourcepub fn serve(
&self,
input: &mut dyn BufRead,
out: &mut dyn Write,
ingest: &dyn PackIngest,
gate: &dyn PushGate,
) -> Result<Option<PushOutcome>>
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.
Sourcepub fn serve_session(
&self,
session: Session,
input: &mut dyn BufRead,
out: &mut dyn Write,
ingest: &dyn PackIngest,
gate: &dyn PushGate,
) -> Result<Option<PushOutcome>>
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.
Sourcepub fn write_empty_advertisement(
hash_kind: Kind,
config: &Config,
out: &mut dyn Write,
) -> Result<()>
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.
Sourcepub fn read_preamble(
hash_kind: Kind,
input: &mut dyn BufRead,
) -> Result<Option<Preamble>>
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.
Sourcepub fn serve_after_preamble(
&self,
preamble: Preamble,
input: &mut dyn BufRead,
out: &mut dyn Write,
ingest: &dyn PackIngest,
gate: &dyn PushGate,
) -> Result<PushOutcome>
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.