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.
- LOCK_
WAIT_ MARGIN - Extra time a waiter gives the lock holder beyond the holder’s whole push, so a holder that runs to its own deadline 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. - lock_
wait_ limit - What: How long a process waits for another invocation’s push lock: the environment’s value, or the push deadline plus the stop grace plus a margin. Why: The holder may run its whole push deadline and then needs the stop grace to end, so the default waiter outlasts a holder that is merely slow 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.