Expand description
The refs git feeds pre-push on stdin, read ONCE and shared.
git writes one line per ref being pushed:
<local ref> <local oid> <remote ref> <remote oid>This exists because stdin can only be consumed once. While checks were
separate processes with INHERITED stdin, whichever ran first drained it and
the rest saw EOF — silently. Two repos in the fleet had a custom
pre-push-branch-protect.sh whose while read loop sorted BEFORE
pre-push-run-tests-js, so the test gate received no refs and ran nothing.
Nobody noticed, because “no refs” and “nothing to test” look identical.
Reading it in one place and lending the result to every check removes that whole class of bug, and makes it impossible to reintroduce by adding a second stdin reader.
Structs§
- PushRef
- Push
Refs - Lazily-read pushed refs.
OnceLockrather thanOnceCellbecause pre-commit runs its checks on threads andCtxmust therefore beSync.
Functions§
- changed_
files - Every path touched by the refs being pushed.
- changed_
files_ for - Every path touched by ONE ref being pushed.
- parse
- synthetic_
from_ upstream - Synthesise the one
PushRefa standalone invocation — no realpre-pushon the other end of stdin — has no other way to obtain:@{u}..HEAD.