Expand description
The auto-push’s real git push with a deadline, its low-speed abort and the lock wait limit derived from it.
What:
Run the auto-push’s real git push with a deadline,
and derive the wait limits the push coordination uses.
Why:
A push whose connection stalls would otherwise hold the branch’s push lock forever,
and every later commit on that branch would wait behind it.
The push is stopped when its deadline passes,
the commit stays saved locally,
and the failure is recorded like any other failed push.
In TS you’d write (pseudocode):
const { exitCode, output } = await nanoSpawn(gitPath, pushArgs, { cwd, signal: AbortSignal.timeout(deadlineMs) });Enums§
- Stop
Cause - Why a push or query was stopped.
Constants§
- DEFAULT_
PUSH_ DEADLINE - How long a push may run when the variable is absent or unusable.
- HOLDER_
BUDGET_ DEADLINES - How many push deadlines of time a lock holder may spend in all, across its upload, its push and a reconcile,
before no further step starts (
holder_budget). - LOCK_
WAIT_ MARGIN - Extra time a waiter gives the lock holder beyond the holder’s whole budget, so a holder that uses all of it is outwaited.
- LOCK_
WAIT_ VARIABLE - Environment variable that sets how long to wait for another invocation’s push lock, in whole seconds.
- LOW_
SPEED_ LIMIT - Lowest transfer speed in bytes per second Git tolerates on an HTTP transfer.
- LOW_
SPEED_ TIME - Seconds the transfer may stay below the lowest speed before Git aborts it.
- MAX_
PUSH_ OUTPUT - The most output bytes kept from one push; a push that writes more is stopped.
- PUSH_
DEADLINE_ VARIABLE - Environment variable that sets the push deadline in whole seconds.
- STOPPED_
EXIT_ CODE - Exit code recorded for a push that this wrapper stopped,
the convention of
timeout(1). - STOP_
GRACE - How long a stopped push gets to end after the polite stop signal before it is killed.
Functions§
- apply_
low_ speed_ defaults - What:
Add Git’s low-speed abort to a push command unless the environment sets it.
Why:
Git ends an HTTP transfer that stays under the limit for the time,
which also ends its helper processes;
the push deadline is only the backstop for transports this does not cover.
Git lets these variables override
http.lowSpeedLimitandhttp.lowSpeedTimefrom its configuration, so only a person’s environment variables are kept, not their configuration. - budget_
spent_ message - The words of a step that was not started because the holder’s time budget was spent.
- holder_
budget - What:
The time a lock holder may spend in all while it holds the push lock.
Why:
Every bounded step of the holder is cut to what is left of this budget (
holder_budgetmodule), so the waiter’s limit can be derived from it. - lock_
wait_ limit - What: How long a process waits for another invocation’s push lock: the environment’s value, or the holder’s whole budget plus two stop graces plus a margin. Why: The holder’s steps end within the budget, and the one step in flight when it runs out needs the stop grace to end and the kill’s collection another, so the default waiter outlasts a holder that is working inside its rights before it reports the lock as stuck.
- positive_
seconds - What: Read a positive whole number of seconds from one environment value. Why: A zero, negative, fractional, empty or non-text value is no setting at all, never “no limit”, so a typo cannot remove a bound.
- push_
deadline - What: The push deadline: the environment’s value, or the default. Why: A person may need a longer deadline on a slow link or a shorter one on a flaky one.
- run_
bounded_ push - What: Run a push command to its end or its deadline and capture its interleaved output. Why: Both streams share one anonymous file so lines keep the order Git wrote them, and a file needs no reader thread that a stuck helper could keep alive. A stopped push becomes a failed attempt that says so, so the commit stays saved and the failure is recorded for later invocations.
- stop_
push - What: Stop a running push: ask politely, wait the grace, then kill and collect it. Why: Git’s own signal handling ends the helpers it started, and a push that ignores the request cannot outlive the kill.
- strip_
one_ line_ break - Remove exactly one trailing
\nor\r\n, as the captured output of the incumbent does. - wait_
until_ done - What:
Look at a running push until it ends,
its deadline passes or its output floods.
Why:
stdhas no timed wait, so the parent looks withtry_wait, which never blocks.