Skip to main content

Module service_commit_args

Module service_commit_args 

Source
Expand description

Which commit command lines the commit service covers, and the message they stand for. What: Which git commit command lines the resident service lands, and the message such a line stands for. Why: The service lands the scoped commit an agent or a person types most (git commit -m <message> -- <paths>), with the options that only shape the message or the identity: -F <file>, --author, --date, --trailer, --cleanup, --allow-empty-message, -s, --amend and --reset-author. Every other option (editor, signing, templates) still goes through the transaction until the service covers it, so this module answers “is this line one the service covers” before anything is prepared, and builds the message with the clean-up Git applies when no editor opens.

In TS you’d write (pseudocode):

const parsed = parseServiceCommit(args); // undefined when the line needs native git commit

Structs§

ServiceCommitArgs
What a covered command line asked for.

Enums§

FixupKind
Which message prefix --fixup and --squash make.

Functions§

asks_for_quiet
What: Whether the command line itself asks git commit to print no summary (-q, --quiet, in a cluster of short options). Why: The wrapper prints the summary line of a landed commit, so it must know whether the person asked for silence. Values of options are skipped, so -m quick is not a request for silence. A line this reading does not understand counts as not quiet: a summary printed without need costs a line, and one withheld hides the commit’s name.
cleanup_message
What: The commit message Git makes of the given texts when no editor opens. Why: Each text is a paragraph; Git strips trailing whitespace from every line, drops leading and trailing blank lines, squeezes runs of blank lines into one and ends the message with a newline. An empty result is no message.
opens_editor
What: Whether git commit with these arguments may open an editor. Why: The answer decides what happens to a commit Git built when the branch moved meanwhile: with no editor it is built again on the new tip, with an editor the typed message is saved for the person instead of being lost. It errs towards “may open”: an option this reading does not know, or a spelling Git accepts as an abbreviation, counts as an editor, because a message saved without need costs nothing and a message lost costs the person’s typing.
parse_service_commit
What: Reads the arguments after commit and says whether the service covers them. Why: Anything not listed here is refused, so a new Git option is never silently dropped.
with_fixed_message
What: The arguments of a commit Git built, rewritten so that the message the person already typed is used as it is and no editor opens. Why: After the editor has run the message is fixed, so a commit built on a tip that has since moved is built again from -F <file> with the message kept verbatim. A line that takes its author or its parents from another commit (-c, -C, --fixup, --squash, --amend) cannot be rebuilt that way, and an abbreviated option that may be one of the dropped ones is not guessed at: both give nothing, and the caller saves the message and stops.