Repository navigation
A range is read with one git log: two git processes for a range, in place of twenty more a commit - #91
Merged
Conversation
Commits listed a range with git rev-list and then asked git for each commit one field at a time: twenty `git log -1 --pretty=format:<field>` a commit, one for every key of FieldNames. A range of n commits started 2 + 20n gits before any rule ran. entries reads every field of every commit of the range from one `git log`: the formats joined by a NUL, and `-z` for a NUL between commits. No field holds a NUL, so a body is read whole whatever its lines. Each field is trimmed and its CRLF folded as before. LogCommit is the same reader with `-1`. A range now starts two gits whatever its length: the one that checks it resolves, and the log. One thing changes besides the count. With log.showSignature set, git prints what it found of a signature ahead of each commit it shows. The old reader showed a commit twenty times, so every field of a signed commit began with that line: its subject read `Good "git" signature for ...`, then the subject. Nobody can have run with that setting, as every subject would have failed. One log would leave the line in the first field alone; the call passes --no-show-signature, and no field holds it. The signature stays where it belongs, in the fields that ask for it (%G?, %GS, %GK). Measured with the command built before and after, over the 236 commits of b3d5ea7~100..b3d5ea7 in this repository, `-D` counting the gits: 5194 before, 474 after (the two for the range, and two a commit that the whitespace rule still starts); 219 s and 22 s on the same machine. The verbose report is the same byte for byte, 945 lines, and the exit status the same. Field for field, a probe compared what the new reader gives with one `git log -1` a field, as before: 4720 fields of those 236 commits, none differs. TestCommitsRunsTwoGitsWhateverTheRange counts the gits of a range of one commit and of five: two each; against the package as it was, 22 and 102. TestContractLogCommitIsGitsView gains a commit whose message git did not clean, which nothing held: its CRLF is folded. TestContractASignedCommitIsReadAsWritten signs a commit with a key made in the test, sets log.showSignature, and reads it both ways: the fields are as written and none holds the line; against the reader as it was, all twenty do. Broken on purpose, each alone: the CRLF kept; a newline between commits in place of the NUL; the fields given to the wrong names; --no-show-signature left out. Each fails a test. For #50. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: closer-claudio <claudio@farcloser.world>
closer-claudio
force-pushed
the
claudio/20261115-one-git-log
branch
from
November 16, 2026 03:06
d5f337d to
7367299
Compare
closer-claudio
enabled auto-merge
November 16, 2026 03:06
Author
|
Reviewed at 7367299 |
1 similar comment
Author
|
Reviewed at 7367299 |
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
git.Commitslisted a range withgit rev-list, then asked git for each commit one field at a time: twentygit log -1 --pretty=format:<field>a commit, one for every key ofFieldNames. A range of n commits started 2 + 20n gits before any rule ran.🛠️ What
git/commits.go: a newentriesreads every field of every commit of the range from onegit log, the formats joined by a NUL and-zfor a NUL between commits. No field holds a NUL, so a body is read whole whatever its lines. Each field is trimmed and its CRLF folded, as before.LogCommitis the same reader with-1.A range now starts two gits whatever its length: the one that checks it resolves, and the log.
One thing changes besides the count. With
log.showSignatureset, git prints what it found of a signature ahead of each commit it shows. The old reader showed a commit twenty times, so every field of a signed commit began with that line: its subject readGood "git" signature for ..., then the subject, and the commit failed its rules. The new call passes--no-show-signature, and no field holds the line; the signature stays in the fields that ask for it (%G?,%GS,%GK).🧪 How
Measured with the command built before and after, over the 236 commits of
b3d5ea7~100..b3d5ea7in this repository,-Dcounting the gits: 5194 before, 474 after (the two for the range, and two a commit that the whitespace rule still starts); 219 s and 22 s on the same machine. The verbose report is the same byte for byte, 945 lines, and the exit status the same. Field for field, a probe compared what the new reader gives with onegit log -1a field: 4720 fields of those commits, none differs.Tests:
TestCommitsRunsTwoGitsWhateverTheRangecounts the gits of a range of one commit and of five: two each (22 and 102 against the package as it was).TestContractLogCommitIsGitsViewgains a commit whose message git did not clean, which nothing held: its CRLF is folded.TestContractASignedCommitIsReadAsWrittensigns a commit with a key made in the test, setslog.showSignature, and reads it both ways: the fields are as written and none holds git's line; against the reader as it was, all twenty do.Broken on purpose, each alone, and each fails a test: the CRLF kept; a newline between commits in place of the NUL; the fields given to the wrong names;
--no-show-signatureleft out.V:
just lintandjust testgreen on the branch (64 tests; the signed-commit test needsssh-keygenand skips without it).📝 Notes
For #50.