Documentation
¶
Overview ¶
Package git is the chassis's `git` personality: a git smart-HTTP server (clone, fetch, push) over the chassis's own repository store, mounted on the web head under a reserved path prefix (--git-path-prefix, default /git) on every hostname the head serves — https://<host>/git/<repo>.git is what a developer clones. A stock git client speaks to it; nothing is installed on the machine, no repository is materialised on disk.
The head knows repositories, refs and pushes, and nothing about what a repository holds. What a push MEANS is a tenant stack's: before a ref moves the head asks the tenant's `_git` stack (the answer lane, default deny) and after the reply it tells it (the observe lane) — the contacts head's two lanes [G1]. Accepting a push and acting on it are two different refs moved by two different parties (docs/0059 §7).
The wire protocol is git's v0 "smart" protocol over HTTP, the one every client speaks (v2 is not advertised, so clients fall back). go-git supplies pkt-lines, the packp messages, packfile parsing and encoding, the object model and the reachability walk; the framing, the per-ref compare-and-swap, the hook point between "objects stored" and "refs moved", and the limits are this package's — go-git's own server (plumbing/transport/server) updates refs with a plain SetReference and carries a TODO for atomic, so it could not be the server.
Limits are enforced at the door, not by the application later: a pack (--git-max-pack-bytes), an object (--git-max-object-bytes), a count (--git-max-objects), a repository (--git-max-repo-bytes), and, by default, text only (--git-text-only): a blob that is not valid UTF-8, a symlink, an executable or a submodule is refused with a one-line reason the client prints.
Index ¶
- Variables
- type Actor
- type Change
- type Controller
- func (c *Controller) Enabled() bool
- func (c *Controller) Handler() http.Handler
- func (c *Controller) Limits() Limits
- func (c *Controller) Prefix() string
- func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (c *Controller) SetAuth(r *authn.Resolver)
- func (c *Controller) Start()
- func (c *Controller) Stop()
- type ErrRefMoved
- type HostResolver
- type Limits
- type Push
- type RefUpdate
- type Repo
- type RepoLoader
- type Staging
Constants ¶
This section is empty.
Variables ¶
var NewMemRepos = gitcore.NewMemRepos
NewMemRepos is the in-memory loader (tests; the prototype).
Functions ¶
This section is empty.
Types ¶
type Actor ¶
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.
type Change ¶
type Change struct {
Path string
Hash plumbing.Hash
Size int64
Mode filemode.FileMode
// Op is add, modify or delete.
Op string
}
Change is one file a push changes, as the lane hears it [G1]: the path, the blob, its size and mode, and what happened to it.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller owns the head's shared state: the repository loader, the login resolver and the limits. It binds no listener of its own — the web head mounts Handler().
func NewController ¶
func NewController(ctx context.Context, pu *processor.Unit, repos RepoLoader, resolver HostResolver) *Controller
NewController constructs (but does not start) the head. A nil loader (git personality off) yields an inert controller whose Handler answers 404 and whose Start is a no-op.
func (*Controller) Enabled ¶
func (c *Controller) Enabled() bool
Enabled reports whether the head serves anything: the personality is on and a repository loader was given.
func (*Controller) Handler ¶
func (c *Controller) Handler() http.Handler
Handler is the http.Handler the web head mounts on Prefix()/.
func (*Controller) Prefix ¶
func (c *Controller) Prefix() string
Prefix is the reserved path prefix (no trailing slash).
func (*Controller) ServeHTTP ¶
func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the whole request flow: hostname → tenant, the path → a repository and a service, Basic auth for the service's scope, then the service itself. Everything is answered here; nothing runs a stack except the lanes a push dispatches [G1].
func (*Controller) SetAuth ¶
func (c *Controller) SetAuth(r *authn.Resolver)
SetAuth hands the head the login resolver (chassis/authn).
func (*Controller) Start ¶
func (c *Controller) Start()
Start logs the mount. The head itself is served by the web head, so a `git` personality without `web` serves nothing — say so.
type ErrRefMoved ¶
type ErrRefMoved = gitcore.ErrRefMoved
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.
type HostResolver ¶
HostResolver maps a request's Host to its tenant — the same routing every web request uses (ingress.DBResolver.ResolveErr). Tests inject.
type Limits ¶
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.
func LimitsFromConfig ¶
LimitsFromConfig reads the --git-* caps.
type Push ¶
type Push struct {
Tenant string
Repo string
Who authn.Authenticated
ClientIP string
// Commands are the client's ref updates, in its order.
Commands []*packp.Command
// Changes are the files each command changes, old tree → new tree.
Changes map[plumbing.ReferenceName][]Change
// contains filtered or unexported fields
}
Push is one receive-pack request after its objects are staged: what the lane is asked about and what the refs are moved from.
type RefUpdate ¶
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.
type Repo ¶
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.
type RepoLoader ¶
type RepoLoader = gitcore.RepoLoader
The storage seam is the protocol core's (chassis/git); the head uses it under its own names.