Conversation
…ize gone entries in status --global
feat: hook identity, user-defined commit rules, a wider lock and an uninstall (0.6.0)
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.
Six changes. Four came from the backlog; two came from the owner using the tool and finding it wanting.
From the backlog
GK-E — an outdated builtin is recognised, not frozen.
detect_builtincompared the entire script character for character against the current version, so any edit to a builtin — a typo fix, a new vendor address — orphaned every repository running the previous one. The migration then absorbed it as00-preexisting, a hand-written hook gitkit never touches again, and the user kept running the old rule while seeing a successful install. Builtins now carry an identity marker, with exact-content matching kept as the fallback for hooks installed before it existed.GK-H — commit rules the user defines. The
commit-msgbuiltins were closed, so a team with a ticket prefix or a length limit had to hand-write the hook, which is the thing gitkit exists to prevent.message-rulestakes named regex rules from the repo's config, each with its own help text, positive or negative, scoped to the subject or the whole message, validated when configured rather than at someone else's first commit. This closes GK-G as well: a negative subject-scoped rule covers the trailer smuggled in after a semicolon, which the anchoredno-trailerspattern misses.GK-F — the lock reaches further. It blocked commit and push; a rebase went through untouched.
pre-rebasejoins the default, and reference protection is a separate opt-in axis (--refs) rather than being folded into--all— it is the only lock--no-verifycannot bypass, and that is worth an explicit choice.GK-UNIN — an uninstall that cleans up after itself. gitkit writes into other people's repositories and had no way out.
gitkit uninstallshows its plan and asks first, removes gitkit's parts from every repository in the registry, and restores any hand-written hook it had absorbed.Found by using it
GK-I — the test suite was writing to the user's real registry. Measured on the maintainer's machine:
gitkit status --globalprinted 4965 lines, 1652 of them dead/tmppaths, against two real repositories;registry.tomlwas 235 KB and its last write was during acargo testrun. The registry module isolated its own tests, but every other test that installed a hook in a temp repo went through the realHOME. Isolation is now a property of the harness, with a test that fails if the real registry is touched.status --globalsummarises gone entries in one line and offers--prune.Verified after installing: 4965 lines → 106, and a prune took the registry from 235 KB to 5.8 KB, 1674 repositories to 17.
GK-J — a hook without the execute bit is dormant, and now says so. Git ignores a non-executable hook silently. gitkit reported one as
~ modified, which is true and beside the point. It now reads:Both facts, and the way out.
--repairsets the bit on hooks written directly into.git/hooks, not only on dispatcher parts, and--strictfails on a dormant hook. Verified on a real repository whosecommit-msghad never run since April.Gate green at every commit:
cargo fmt --all,cargo clippy --all-targets -- -D warnings, 673 tests.