Skip to main content

push_http

Function push_http 

Source
pub fn push_http(
    client: &dyn HttpClient,
    local_git_dir: &Path,
    repo_url: &str,
    refs: &[PushRefSpec],
    opts: &PushOptions,
    progress: &mut dyn Progress,
) -> Result<PushOutcome>
Expand description

Push refs to a remote over smart HTTP (git-receive-pack), returning a PushOutcome.

This is the stateless-RPC counterpart to push_remote: instead of a duplex Connection it issues a GET info/refs?service=git-receive-pack discovery (the receive-pack advertisement: remote refs + .haves + capabilities), then a single POST git-receive-pack whose body is the ref-update commands (<old> <new> <ref>\0<caps>\n first, bare after, flush) followed by the packfile; the response is the report-status / report-status-v2.

The decision logic, command framing, pack building (thin + delta + advertised .have set + ofs-delta per caps), and report parsing are the same shared helpers used by push_remote — only the wire (discovery GET + one POST vs. the duplex socket) differs.

client is the embedder’s crate::transport::http::HttpClient; repo_url is the remote repository URL (e.g. http://host/repo.git). progress receives the server’s side-band channel-2 bytes (hook output, remote: … diagnostics) when side-band-64k is negotiated.

Protocol v0/v1 only; a v2 receive-pack advertisement is rejected (a v2 push would require the command=push round and is deferred — matching push_remote).

§Errors

Returns an error if discovery fails, the advertisement is protocol v2, a source object is missing from the local odb, the pack build fails, or on wire/parse I/O failure.