feat(git): improve generated commit hook usability - #246
Merged
Conversation
### Summary Make failed generated commit-message checks explain how to reuse Git’s preserved message without misleading users when pre-commit checks fail earlier. Add an exact-value environment bypass for both generated commit hooks and keep generated slow-check warnings compact. Document the bypass and standalone timer fallback, and cover recovery placement, option-preserving retries, bypass semantics, failure behavior, and byte-exact warning formatting. ### Details Generated commit-msg hooks now report that `.git/COMMIT_EDITMSG` is saved only after a failed check when Git invoked the hook with that exact populated path in a normal checkout. They tell users to rerun their original `git commit` command, replacing message options with `-eF .git/COMMIT_EDITMSG`, which preserves operations such as `-a` and `--amend`. Generated pre-commit hooks never print this recovery advice. Setting `FLAKEBOX_SKIP_GIT_HOOKS=1` bypasses both generated paths; unset and all other values run normally. Git’s existing `--no-verify` remains documented as an alternative. The variable lives only in Flakebox-generated scripts and does not alter unrelated hooks. The generated timed runner marks warning records and streams GNU Parallel stderr through a bounded formatter. It inserts a separator only after unterminated output, removes leading and consecutive blank warning lines, preserves NUL and ordinary bytes, propagates output closure, retains aggregate check status, and closes its formatter descriptor in workers. Standalone internal timer use conservatively retains a leading newline because arbitrary inherited stderr cannot be inspected portably. Regenerate Flakebox’s checked-in hook artifacts and root identity. ### Reviews An independent reliability review initially found unsafe plain-commit retry advice, stderr-proxy hangs and EPIPE/status changes, delayed unbounded buffering, NUL mishandling, a leaked formatter descriptor, and non-portable direct-stderr inspection. The implementation replaced the advice with option-preserving original-command guidance, removed proxy/temp-file designs, added bounded streaming marker formatting, closed the worker descriptor, and narrowed standalone timer behavior with dpc’s approval. Three follow-up reviews verified each fix; the final review passed with no findings. ### Validation - `nix develop -c treefmt` - focused `gitHooks` Nix check - `nix develop -c selfci check` - `nix develop -c selfci check --candidate kzvruqxx`
dpc
marked this pull request as ready for review
July 24, 2026 22:21
dpc
added a commit
that referenced
this pull request
Jul 30, 2026
feat(git): improve generated commit hook usability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Posted by Tau
Summary
Improve generated commit-hook failure output: preserve failed messages with safe original-command retry guidance, provide a one-environment hook bypass, and compact slow-check warnings without changing check output or status behavior.
Details
commit-msgfailure with.git/COMMIT_EDITMSG, tell users to rerun their originalgit commitcommand while replacing message options with-eF .git/COMMIT_EDITMSG. This retains options such as-aand--amend; pre-commit failures do not show message recovery advice.pre-commitandcommit-msgchecks only whenFLAKEBOX_SKIP_GIT_HOOKS=1. Unset or other values run checks normally. Git’s--no-verifyremains an alternative.Reviewers can exercise the behavior with the
gitHooksflake check.