Skip to main content

Module fetch

Module fetch 

Source
Expand description

Wire-protocol fetch orchestration over a crate::transport::Connection.

fetch_remote is the wire counterpart to crate::transfer::fetch_local: instead of copying objects between two on-disk repositories, it drives a git-upload-pack negotiation over a live crate::transport::Connection — resolving wanted oids from the connection’s advertised refs (via the same refspec matching fetch_local uses), running the crate::fetch_negotiator::SkippingNegotiator want/have/done exchange, demultiplexing the side-band pack, ingesting it with crate::unpack_objects, and classifying ref updates into the shared crate::transfer::FetchOutcome.

This is the protocol-v0/v1 negotiation loop lifted from the CLI’s fetch_transport::fetch_upload_pack_negotiate_pack_bytes_with_streams, generalized to run over the crate::transport::Connection reader/writer rather than subprocess pipes.

Protocol v2 over the streaming transports (git://, ssh) is also handled here: a v2 crate::transport::Connection advertises no refs on connect, so fetch_remote first issues a command=ls-refs (deriving ref-prefixes from the fetch refspecs) to recover the ref map, then runs a command=fetch negotiation — multi-round want/have/done with the same crate::fetch_negotiator::SkippingNegotiator — and demuxes the side-band-64k pack from the packfile section. Both paths share the refspec matching, tag-mode, prune, classification, and pack-ingest plumbing. The v2 request fragments are lifted from the CLI’s file_upload_pack_v2 / fetch_transport (write_v2_fetch_request, read_v2_acknowledgments, read_v2_fetch_pack_response, v2_ls_refs_for_fetch). Smart-HTTP stays on v0/v1 (its stateless multi-POST v2 flow is out of scope for this pass).

Structs§

NoProgress
A Progress that discards everything.

Traits§

Progress
Sink for the remote’s human-readable progress (side-band channel 2).

Functions§

fetch_remote
Fetch from a remote over a live Connection, driving the upload-pack negotiation and writing the resulting tracking-ref updates into local_git_dir.