Documentation
¶
Overview ¶
Package gitproto provides helpers for stabilizing git smart-HTTP cache keys.
Only IsUploadPackRequest and NormalizeUploadPackBody are exported; the pkt-line framing parser is an implementation detail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUploadPackRequest ¶
IsUploadPackRequest reports whether r is a smart-HTTP git-upload-pack POST. All three of method, path suffix, and Content-Type must match so that an unrelated POST sharing the URL suffix isn't routed through normalization.
func NormalizeUploadPackBody ¶
NormalizeUploadPackBody returns a stable cache-key input derived from a git-upload-pack POST body. The output is hash input only — never sent on the wire.
Stripped (per-process noise that doesn't shape the pack):
- standalone "agent=" / "session-id=" pkt-lines (v2 capabilities)
- inline " agent=" / " session-id=" tokens on v1 want lines
Preserved (everything that can change the upstream response): wants, haves, capabilities, command=, deepen/shallow, filter, ref-prefix, object-format, and all framing packets. Re-encoding recomputes pkt-line length prefixes, so requests differing only in a stripped value's length still hash equal.
Malformed input is returned unchanged so callers fall back to opaque hashing (cache miss is acceptable; collision is not).
Types ¶
This section is empty.