Skip to main content

Module git

Module git 

Source
Expand description

Git plumbing: keep a bare mirror fresh and serve upload-pack from it.

All git work is delegated to the system git binary, so protocol correctness - including protocol v2, shallow and partial (filtered) clones - comes for free. The proxy never reimplements the wire format; it only:

  1. maps a request to a bare mirror under the cache root,
  2. runs an incremental git fetch from upstream (coalesced per repo),
  3. streams git upload-pack output from the local mirror to the client.

It is strictly read-only: only git-upload-pack (clone/fetch) is served, and upstream is only ever pulled from - nothing is pushed or replicated proactively. A miss transparently pulls from upstream, so the cache is never stale for the ref the client actually asked for.

Structs§

GitCache
GitConfig
TimedReader
Wraps upload-pack’s stdout to record how long the packfile took to serve. The duration spans from the RPC starting to the stream reaching EOF - or the client disconnecting, caught by Drop - so it includes the client’s read speed: this is serve latency, not pure generation time. Recorded exactly once (the Option is taken on the first of EOF or drop).

Enums§

CacheOutcome
What ensure_fresh did - for metrics.