Skip to main content

Module command_push

Module command_push 

Source
Expand description

The Git 2.56.0 option table of git push and its facts. What: The complete git push option table of Git 2.56.0 and the facts read from it. Why: The atomic-push transform must know whether the caller already chose atomicity, and the manual-push gate whether the push is a dry run; both in every spelling Git accepts (--at, --no-at, -nf), which a list of exact tokens misses.

In TS you’d write (pseudocode):

// parsePushRegion(postSubcommandArgs): PushRegion  (throws OptionError)

Structs§

PushRegion
What: Final-state facts of one git push region. bool is true or false; Vec<WrapperOccurrence> is an owned list of wrapper-flag positions. Why: atomic_stated is “the caller chose”, in either direction; dry_run is the state after the last -n, --dry-run or --no-dry-run.
PushShape
What: Where a push goes and what it names, read from its option region. Why: The Git LFS upload that runs before a push needs the destination remote and the refs the push will send; an explicit repository and explicit refspecs name them, and the options that send more than the named refs (--all, --tags, --mirror) say which kinds of ref are sent.

Constants§

ALL
--all and its alias --branches: every local branch.
ATOMIC
--atomic: request an atomic transaction on the remote side.
DELETE
-d, --delete: remove remote refs.
DRY_RUN
-n, --dry-run: do everything except send the updates.
FOLLOW_TAGS
--follow-tags: add the annotated tags that point into the pushed history.
FORCE
-f, --force: update a ref that is not a descendant.
FORCE_IF_INCLUDES
--force-if-includes: a safety check that only means something with a forced push.
FORCE_WITH_LEASE
--force-with-lease: force when the remote ref is still what the caller expected.
MIRROR
--mirror: make the remote’s refs equal the local ones.
NO_VERIFY
--no-verify: bypass the pre-push hooks, the Git LFS upload included.
PORCELAIN
--porcelain: machine-readable output that a script parses.
PRUNE
--prune: remove remote refs that have no local counterpart.
PUSH_TABLE
What: Rows of options[] in cmd_push (builtin/push.c:707-743), in source order. &[OptionSpec] is a borrowed table baked into the program. Why: --branches is an OPT_ALIAS of --all; the two names share no prefix, so the alias needs no special ambiguity handling and is a row of its own.
RECURSE_SUBMODULES
--recurse-submodules: also push the submodules’ commits.
REPO
--repo: the destination is an option and not the first positional argument.
SET_UPSTREAM
-u, --set-upstream: record the pushed branch as the local branch’s upstream.
TAGS
--tags: every local tag.

Functions§

parse_push_region
What: Parse the region after push. Result<A, B> is “either success A or failure B”. Why: A region Git itself would refuse yields the refusal, never a guessed fact set.
push_shape
What: Read the destination and the named refs of a push. None when the region is one Git itself would refuse. Why: One reading of the arguments serves the upload plan, so the remote and the refs it names are the ones Git reads.
stackable_option_tokens
What: The option tokens of a push that may be integrated after a rejection, or nothing when it may not. Option<Vec<OsString>> is “the tokens, or no answer”. Why: Only a plain update of branches keeps its meaning when the wrapper merges what landed on the remote and pushes the merge; the stacked push repeats these tokens and replaces the remote and refspec arguments, so the caller’s --no-verify, --push-option and the like still apply. A region the table refuses, a forced refspec (+src:dst) and every option in NOT_STACKABLE give nothing.