http.git.serve

http.git

serve(repos) -> handle, err

Build an http.server handler serving the given repositories read-only

repos maps URL prefixes to repository paths, e.g. { ["/lilush"] = "/srv/git/lilush.git" }. Each path must be a git directory (bare repository) or a worktree containing .git. URLs may carry an optional .git suffix (clone http://host/lilush.git works).

The returned function matches the http.server handler contract: handle(method, query, args, headers, body, ctx). An upload-pack answer that carries a pack comes back as a producer (see upload_pack_stream), and its walk gives the loop a turn every 32 objects.