fix: put generated pre-commit shebang first#236
Merged
Conversation
dpc
commented
Jul 9, 2026
| } | ||
| export -f check_nothing | ||
|
|
||
| # |
Contributor
Author
There was a problem hiding this comment.
This is a wrong place? This should have been under shebang, but otherwise on top.
5f4869e to
7ddce22
Compare
### Summary Fix flakebox pre-commit hook generation so generated `misc/git-hooks/pre-commit` starts with the intended bash shebang on line 1, followed immediately by the flakebox generated-file banner. This prevents direct execution from falling back to `/bin/sh` on systems that honor only a first-line shebang, while keeping the banner at the top of the generated file. ### Details The pre-commit generator now owns the executable script prologue: it emits `#!/usr/bin/env bash`, then the generated-file banner, then includes the reusable hook body fragment. The former `pre-commit.head.sh` fragment was renamed to `pre-commit.body.bash` and no longer carries its own shebang, making it clear that it is not a standalone script. The `gitHooks` regression check builds the generated root, asserts the first line of both generated git hooks is `#!/usr/bin/env bash`, asserts the pre-commit banner immediately follows the shebang, and runs `bash -n` on the generated hooks. Regenerated the checked-in pre-commit hook and root id. Validation and independent review passed.
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.
PR published by Tau
Summary
Fix generated git pre-commit hooks so their bash shebang is on line 1. This prevents direct hook execution from falling back to
/bin/shon systems where/bin/shis not bash.Details
The generated pre-commit hook now keeps the flakebox banner below the hook head/shebang. A regression check verifies generated
pre-commitandcommit-msghooks have line-1 shebangs and passbash -n.