Repository navigation
Whitespace is checked commit by commit: a merge is not blamed, a first commit is checked - #92
Merged
Conversation
…t commit is checked The dangling-whitespace rule ran `git log --check X^..X` on each commit. Two things followed from writing the commit as that range. A merge was failed for commits that are not in the range validated. `X^..X` is every commit X has that its first parent has not: for a merge, all that the second parent brings. A branch that merges main into itself, where main holds a commit with a trailing blank, was reported, on `--range main..feature`, as a merge with whitespace errors, with `git show --check <merge>` to see them, which shows nothing. The error is main's, merged long ago. A first commit was never checked. The range cannot be written for a commit with no parent, so the rule listed the whole history of every commit, one more git a commit, to learn whether it was the first, and skipped it: a first commit with a trailing blank passed. git.Check now runs `git log --check X^!`, the commit without its parents' histories. It is one git, with no listing of the history before it. A merge answers for nothing: what it brings in is not its own, and git shows no change for a merge. A first commit is checked as any other, whatever the user's log.showRoot, which the command sets: with it off git shows nothing for a first commit. A commit a shallow clone was cut at is not a first commit. git shows it with no parent, as adding the whole tree, so `X^!` finds there every whitespace error of the history before it. The old listing took it for the first commit and skipped it; it is still skipped, and `-D` still records it. It is told from a first commit by its own object, which names a parent git does not show; a clone as deep as the history lists its first commit as where it was cut, and that one names none. A clone of depth 1, as actions/checkout makes by default, passes a run with no range as it did. Two verdicts move: - a merge that brings in commits with whitespace errors passes; - a first commit with whitespace errors fails, where a range reaches it. With the reader's change before this one, a range of n commits with nothing to report starts 2 + n gits, where it started 2 + 22n. A commit git finds something in costs one more, to see whether git shows it a parent, and a second to read its object when git shows it none. UPSTREAM.md's row on `-D` names the skipped check for what it now is. TestContractCheckFindsWhitespaceErrors holds a first commit, a merge of others' errors and a merge that adds a line itself; TestContractCheckOfAFirstCommitAndOfACut holds log.showRoot off, clones of depth 1 and 2 over a first commit with a trailing blank, and clones that hold the first commit, one at the very depth of the history; TestContractWhitespaceIsEachCommitsOwn holds the two verdicts and the clone of depth 1 through the command. Against the check as it was, the first and the third fail. Measured one at a time, the file restored: with a cut commit checked as a first one, the clones of depth 1 and 2 fail in the second and the clone of depth 1 in the third; with log.showRoot left to the user, the first commit passes in the second. For #50. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: closer-claudio <claudio@farcloser.world>
closer-claudio
enabled auto-merge
November 16, 2026 09:35
Author
|
Reviewed at cb70d59 |
1 similar comment
Author
|
Reviewed at cb70d59 |
apostasie
approved these changes
Nov 16, 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
The dangling-whitespace rule ran
git log --check X^..Xon each commit. Writing the commit as that range had two consequences.X^..Xis every commit X has that its first parent has not; for a merge, that is all the second parent brings. A branch that merged main into itself, where main held a commit with a trailing blank, was reported on--range main..featureas a merge with whitespace errors.git show --check <merge>, which the report points to, shows nothing.🛠️ What
git.Checkrunsgit -c log.showRoot=true log --check X^!: the commit without its parents' histories, one git, no listing of the history.Verdicts that move:
log.showRoot.What does not move: a commit a shallow clone was cut at. git shows it with no parent, as adding the whole tree, so it is not checked, as before, and
-Drecords it. It is told from a first commit by its own object, which names a parent git does not show. A clone of depth 1, as actions/checkout makes by default, passes a run with no range as it did.That commit is still printed
PASSfor a check that was not made, said only under-D: #93.Not breaking for a lane that validates
origin/<base>..HEAD: such a range reaches a first commit only in a repository with no upstream history at all.A range of n commits with nothing to report starts 2 + n gits, where it started 2 + 22n before #91. A commit git finds something in costs one more, and a second when git shows it no parent.
🧪 How
TestContractCheckFindsWhitespaceErrors(git/contract_test.go): a first commit, a merge of others' errors, a merge that adds a line itself.TestContractCheckOfAFirstCommitAndOfACut:log.showRootoff; clones of depth 1 and 2 over a first commit with a trailing blank; clones that hold the first commit, one at the very depth of the history.TestContractWhitespaceIsEachCommitsOwn(cmd/git-validation/contract_test.go): both verdicts and the clone of depth 1, through the command.log.showRootleft to the user, the first commit passes in 2. Each measured alone, the file restored.just lintandjust testpass (66 tests).📝 Notes
UPSTREAM.md's row on-Dnames the skipped check for what it now is.For #50.