Skip to main content

serve_with_pack

Function serve_with_pack 

Source
pub fn serve_with_pack<W: Write>(
    repository: &impl Repository,
    request: Request<'_>,
    scratch: &mut [u8],
    output: &mut W,
    write_pack: impl FnOnce(&mut [u8], &mut PackOutput<'_, W>) -> Result<()>,
) -> Result<Response>
Expand description

Serve with a host-provided complete-pack writer. It is called once only for a valid upload-pack request ending in done, after writing ACK/NAK packets. The writer must emit a complete checksummed pack containing exactly this repository’s objects, and respect the repository’s stability contract. All refs must alias HEAD; independent roots return Unsupported before output or invoking the writer. Use serve_with_selection for those roots. The supplied sink handles negotiated sideband framing. Complete-pack hooks may resend common history; use selection to omit it. Other routes and no-done requests use the ordinary behavior. On error discard the entire response.