Skip to main content

Module land

Module land 

Source
Expand description

amont land — push the current branch, then prove the remote ref moved.

A push that exits 0 says the remote ACCEPTED something. It does not say the branch now points where you pushed it: a forge that loses an accepted ref update, a replica that has not caught up, and a | tail that threw the exit status away all end the same way, a green terminal and a stale branch. The proof is one question asked of the remote afterwards, and this verb asks it every time, so nobody has to remember to.

Before every push attempt it runs a pre-stage (ADR-0018): the heavy gates the push owes run in a child amont rehearse --wait, told the push’s real ref line, with no connection open; the push’s own hook then finds them stamped and runs only the unscoped checks. The stamps, the attestation and those checks stay in the pre-push hook; land neither re-implements nor skips them.

Exit codes (2 stays the binary-wide usage error):

codestatusmeaning
0landedthe remote ref equals the pushed sha
1refuseda gate, a hook, the server, or a precondition said no
2usagewrong invocation
3unreachablethe remote could not be reached, or the push was
/ unverifiedaccepted but could not be checked
4not-observedaccepted, but the expected tip was not observed
128+ninterruptedkilled by signal n
0detached--detach: a worker was started; the receipt says
how it ended (--wait reads it)

--wait <receipt> exits with the code of the status the receipt ended in, and with 1 (a refusal; its worker <pid> died lines tell it apart) when the worker died without finalizing it.

4 is deliberately worded as “not observed”. Equality proves the tip was seen; inequality does not prove an update was lost, because another writer may have advanced or replaced the ref in between. The observed sha is reported so the person can tell which.

Structs§

Report
Everything the output is made of. Filled in as the run learns things, so a run that stops early still prints what it knew.

Enums§

Mode
Whether a non-fast-forward may replace the remote ref.
PrestageState
What land’s pre-stage did (ADR-0018), as --json reports it.
Status
How the run ended. One value per exit code family.

Constants§

LAND_EVIDENCE_MISSING
The line that hook prints, first, when the range is the pre-stage’s but a gate it owes carries no evidence: a defect, named with the gates.
LAND_REMOTE_MOVED
The line the hook of land’s own push prints, first, when the pushed range’s remote side is not the one land’s pre-stage ran against: the remote moved under land (ADR-0018). Matched in the push’s output, never the prose after it.

Functions§

command
amont land [--force] [--json] [--dry-run] [--detach], amont land --tag <name> [--json] [--dry-run] [--detach], or amont land --wait <receipt>.
parse_tip
The tip ls-remote <url> <ref> printed; empty when it printed nothing (the ref does not exist).
truncate_middle
… in the middle of s so it fits max columns. Counts chars, which is right for branch names (ASCII in practice, and a wide glyph only makes the line shorter than the budget, never longer).
usage_json
The JSON document a usage error prints under --json, so a script that parses stdout never has to special-case exit 2.
verdict
The last line printed: plain text, no colour, no glyphs, at most 80 columns whatever the branch is called. Outcome word, the two shas, then the branch in whatever room is left.