Repository navigation
Slim down kw-pre-commit: drop dead code, delegate to standard hooks - #2641
Merged
blowekamp merged 3 commits intoJul 20, 2026
Merged
Conversation
blowekamp
force-pushed
the
fix/kw-pre-commit-submodule-check
branch
from
July 20, 2026 13:22
b2085d2 to
9bbe3a7
Compare
The "Merge checks" section called check_module_rewind, a function that is never defined anywhere in this script (it was dropped when Gerrit/hook-chaining support was removed), so this branch would fail with "command not found" if it ever executed on a merge commit touching a submodule. It's also moot for this repository: the forbid-submodules hook in .pre-commit-config.yaml already rejects submodules entirely, so no commit can ever reach a state where a gitlink (160000) diff entry exists for this dead code to act on. Also drops the merge_head variable, which was only used to feed this now-removed section.
Remove the check_mode/mode_looks_exe/mode_not_exe/mode_bad_exe/mode_non_file functions from kw-pre-commit. This logic is superseded by the standard check-shebang-scripts-are-executable (already enabled) and the newly added check-executables-have-shebangs pre-commit-hooks, which cover the same executable-bit/shebang mismatch cases using git's own index mode and identify's content-based type detection, without kw-pre-commit's catch-all branch that incorrectly flagged newly added symlinks as invalid file modes. The ghostflow-check-main action enforces Windows batch files to be marked as executable. This requires exclusion of the bat extension. WIP: message or fix iup
Move the check_size/size_too_large/size_validate_* logic out of kw-pre-commit into Utilities/Hooks/check-file-size.py, registered as its own local pre-commit hook (check-file-size, language: python). Behavior is preserved exactly: per-path overrides via git attribute file entries for hooks-max-size/hooks.MaxObjectKiB, falling back to the hooks.max-size/hooks.MaxObjectKiB git config defaults (1024 KiB). This has no standard pre-commit-hooks equivalent, since check-added-large-files has no mechanism for per-path attribute-driven size overrides, so the custom logic is kept but isolated from the rest of kw-pre-commit's now-shrinking bash script.
blowekamp
force-pushed
the
fix/kw-pre-commit-submodule-check
branch
from
July 20, 2026 14:21
9bbe3a7 to
d97d41b
Compare
blowekamp
marked this pull request as ready for review
July 20, 2026 19:40
dave3d
approved these changes
Jul 20, 2026
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.
Clean up
Utilities/Hooks/kw-pre-commitby removing logic that is eitherdead or now duplicated by standard
pre-commit-hooks, and by extractingthe remaining custom file-size check into its own Python hook.
Changes
undefined
check_module_rewindfunction and is redundant now thatforbid-submodulesis enabled.check_mode,mode_looks_exe,mode_not_exe,mode_bad_exe,mode_non_file) —superseded by the standard
check-shebang-scripts-are-executable(already enabled) and newly-added
check-executables-have-shebangshooks. This also drops a bug where the catch-all branch mis-flagged
newly added symlinks as an invalid file mode.
Utilities/Hooks/check-file-size.py,registered as its own local
check-file-sizehook (language: python).Behavior is preserved: per-path overrides via
hooks-max-size/hooks.MaxObjectKiBgit attributes, falling back to thehooks.max-size/hooks.MaxObjectKiBgit config defaults. There's nostandard-hook equivalent since
check-added-large-fileshas noper-path attribute-driven override mechanism.
Remaining in kw-pre-commit
Committer-identity validation, non-ascii filename rejection, and the
.gitattributes-driven whitespace checks (tab-in-indent,no-lf-at-eof) — none of these have standardpre-commit-hooksequivalents.