Skip to main content

Module push_stacking

Module push_stacking 

Source
Expand description

An explicit push that lost a race: run as a child, merge in what landed on the remote and publish the merge. What: An explicit git push that lost a race: the commits that landed on the remote since the local base are merged in the object store, and the merge is published by the wrapper pushing it again through its own gates. Why: Several sessions push to one branch all day; a push rejected because the remote moved cannot succeed again, and every caller would fetch, merge or rebase and retry by hand while racing the others. The wrapper runs an eligible push as a child with the caller’s streams, so Git’s own output is unchanged. Only a failed push is looked at again, and only a divergence of the destination is acted on; an authentication, offline, hook or rule refusal keeps the exit status and the text Git gave. The merge is pushed through the same push planning, run inside this process (stacked_merge_push) with STACKED_PUSH_MARKER set in the planned environment, so the policies that gate any push read the integrated result and the marker stops that push from stacking again. The wrapper never starts itself for this. A push that carries the Git LFS upload also runs here, as a child, so this parent can explain a failed upload.

In TS you’d write (pseudocode):

const code = await runPush(args); if (code !== 0) code = (await stackFailedPush({ args })) ?? code;

Structs§

StackRequest
What a failed explicit push needs to be integrated.

Constants§

STACKED_PUSH_MARKER
The environment variable the stacked push carries so that it is never stacked again.

Functions§

run_stacked_push
What: Run an eligible explicit push as a child with the caller’s streams, then integrate it when it failed on a divergence. Why: The wrapper must outlive Git to look at its status; nothing is buffered, so Git’s own output is what the person sees.
stack_failed_push
What: Integrate the remote’s new commits after an explicit push failed, or say nothing when the failure was no divergence. Option<i32> is “the new exit status, or nothing to change”. Why: The status is 0 when the merge was published, and the failing status when the run says why it was not (a conflict, a gate that refused the merge, a remote that kept moving); every other failure returns nothing and prints nothing, so the person sees only Git’s own report.

Type Aliases§

MergePush
How the merge of an integrated push is published, returning the push’s exit status.