ExGitEngine. WireProtocol. ReceivePack
(ex_git_engine v0.9.2)
Copy Markdown
Module implementing the git-receive-pack command.
Summary
Functions
Builds the complete push response combining status and hook messages.
Parses capabilities from the first reference line.
Parses ref update commands from the client.
Executes ref update commands inside a single GitAgent transaction.
Builds the push response output for successful operations.
Generates report-status response for successful ref updates.
Wraps a line with sideband framing for multiplexed transmission.
Validates a push command against the current repository state.
Types
@type cmd() :: {:create, ExGitEngine.Git.oid(), binary()} | {:update, ExGitEngine.Git.oid(), ExGitEngine.Git.oid(), binary()} | {:delete, ExGitEngine.Git.oid(), binary()}
@type t() :: %ExGitEngine.WireProtocol.ReceivePack{ advertised_caps: term(), agent: ExGitEngine.GitAgent.agent(), client_caps: [binary()], cmds: [cmd()], repo: ExGitEngine.GitRepo.t(), state: :disco | :update_req | :pack | :buffer | :done, writepack: ExGitEngine.GitWritePack.t(), writepack_progress: ExGitEngine.Git.odb_writepack_progress() }
Functions
Builds the complete push response combining status and hook messages.
Assembles status output with optional hook messages, handling sideband multiplexing when advertised.
Parses capabilities from the first reference line.
Extracts client capabilities from the null-delimited first ref line. Returns a tuple of {capabilities, refs}.
Parses ref update commands from the client.
Converts command strings into structured tuples representing create, delete, or update operations.
Executes ref update commands inside a single GitAgent transaction.
Calls GitRepo.pre_push/2 first — inside the transaction — so the
protection check and the ref update are serialized through the GenServer.
This prevents a race where two concurrent pushes both pass pre_push
before either commits, then the second one gets :stale_ref instead of
the expected pre_push rejection reason.
Builds the push response output for successful operations.
Returns status tuples optionally wrapped in sideband format if the client advertised support for it.
Generates report-status response for successful ref updates.
Returns tuples indicating successful update status for each ref command.
Wraps a line with sideband framing for multiplexed transmission.
Encodes the line with the specified band number in PKT-LINE format.
Validates a push command against the current repository state.
For :update commands, checks that the client's old_oid matches the
current ref (stale-ref / force-with-lease semantics) and that new_oid
is a fast-forward of the current tip.