Skip to main content

amont_runtime/hooks/
post_commit.rs

1//! post-commit — bind the pre-commit gate marker to the commit that now
2//! exists.
3//!
4//! The commit object does not exist while pre-commit runs, so this is the
5//! earliest moment "the checks ran" can be attached to a hash. git invokes
6//! post-commit even for `--no-verify` (the flag skips only pre-commit and
7//! commit-msg), which is exactly what makes the stamp trustworthy: a commit
8//! that dodged the checks arrives here with no marker and gets no stamp.
9//!
10//! Notification-only, like the hook itself: git ignores its exit code, so
11//! this never blocks, and it prints nothing — a bookkeeping step that talked
12//! on every commit would be noise nobody asked for. That includes the bypass
13//! ledger: a commit that dodged its gate is COUNTED here, silently — the
14//! number's whole value is that it is collected without a lecture. The
15//! mechanisms live in [`crate::gate_stamp`] and [`crate::bypass`]; this is
16//! only the hook-shaped door to them.
17
18use crate::check::Verdict;
19
20pub fn run(ctx: &crate::registry::Ctx) -> Verdict {
21    let stamped = crate::gate_stamp::bind_to_head();
22    crate::bypass::note_unverified(ctx.manifest, &stamped);
23    Verdict::Proceed
24}