Repository navigation
Count subject characters, and refuse a range git cannot resolve - #39
Merged
Merged
Conversation
Two decisions on the command's contract. The short-subject rule counted bytes against its limits of 90 and 72, so a subject of 85 accented characters failed as 170 bytes, where GitHub's ellipsis and a reader count characters. The rule counts runes. A --range git could not resolve was silently replaced by the whole history the clone has, from its oldest commit: the fallback exists for a shallow CI clone whose depth does not reach the range's start, and it swallowed a typo and a missing ref with it, validating everything and passing. The fallback now applies to a shallow clone only (git rev-parse --is-shallow-repository); in a repository with its whole history the range is an error that names it and the git command that failed, unwrapping to git's exit as before, and nothing is validated. The contract cases for both land with the decision: an 89-character non-ASCII subject passes and a 90-character one fails; an unresolvable range exits non-zero with the range on stderr and no commit validated; a shallow clone with a range past its depth still runs over what it has. The two pins of the old behaviour move with it: the range test's bad range is refused, and the outside-a-repository error names git rev-list, the command that fails first there. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: closer-claudio <[email protected]>
closer-claudio
enabled auto-merge
October 23, 2026 05:44
Author
|
Reviewed at 612f998 |
apostasie
approved these changes
Oct 24, 2026
This was referenced Oct 24, 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.
Why
Two decisions on the command's contract, recorded as #34 and #35.
The short-subject rule counted bytes against its limits of 90 and 72, so a subject of 85 accented characters failed as 170 bytes, where GitHub's ellipsis and a reader count characters.
A
--rangegit could not resolve was silently replaced by the whole history the clone has, from its oldest commit. The fallback exists for a shallow CI clone whose depth does not reach the range's start, and it swallowed a typo and a missing ref with it, validating everything and passing.What
rules/shortsubject/shortsubject.go: the rule counts runes.git/commits.go: the fallback applies to a shallow clone only (git rev-parse --is-shallow-repository); in a repository with its whole history an unresolvable range is an error that names it and thegit rev-listcommand that failed, unwrapping to git's exit as before, with git's own message, and nothing is validated.cmd/git-validation/contract_decided_test.go: the contract cases for both: an 89-character non-ASCII subject passes and a 90-character one fails; an unresolvable range exits non-zero with the range on stderr and no commit validated; a shallow clone with a range past its depth still runs over what it has.git/contract_test.go,git/commits_test.go: the two pins of the old behaviour move with the decision: the range table's bad range is refused with git's message, and the outside-a-repository error namesgit rev-list, the command that fails first there.If the shallow case is to be refused as well, it is the one
shallowRepositorycondition to drop and the third contract case to invert.Verification
just lint18/18 andjust test(54 tests, plain and under the race detector) on the branch.Closes #34 and #35.
Created by @apostasie personal assistant