Skip to main content

Module post_commit_hook

Module post_commit_hook 

Source
Expand description

The post-commit run after a landing: author environment, hook lock, and the hook runner with inherited streams. What: The single post-commit run after a landing: its author environment, the hook lock around it, and the real Git hook runner with inherited standard streams. Why: The incumbent’s commit-landing-post-commit-hook.ts runs it outside both landing locks, under the hook lock unless hooks.concurrentCommits is true or an outer preparation lease is inherited. Its exit status is ignored, as native Git ignores it, and the user sees the hook’s output on the terminal.

In TS you’d write (pseudocode):

await runPostCommitHook({ gitPath, cwd, globalArgs, realIndexPath, landedOid, plan });

Structs§

PostCommitHookError
What: A failure of the post-commit run: the author lookup, the hook lock, or the hook’s start. Why: The caller reports the message and exits 1, as the incumbent reports a thrown error after a landing.
PostCommitHookRequest
What: The inputs of one post-commit run. Why: Named fields keep the paths apart, and the plan carries the disabled events and the hook lock.

Enums§

PostCommitHookOutcome
What: Whether post-commit ran, and the status its hook returned when it did. Why: A disabled event runs nothing, and a non-zero status is recorded but never fails the landed commit.

Functions§

author_environment
What: The environment native git commit gives the hook, from the landed commit’s %an, %ae and raw %ad. Why: Hooks read GIT_AUTHOR_*; the incumbent takes the NUL-separated fields and drops one trailing newline.
run_post_commit_hook
What: Run post-commit once for a landed commit. Why: The order matches the incumbent: disabled check, author lookup, hook lock, hook run, lock release.