Repository navigation
Refuse author values git would rewrite in WithAuthor [patch] - #240
Merged
Merged
Conversation
git splits "Name <email>" at the first '<' and the first '>' after it, and strips '<', '>' and newlines from the name, all with exit code 0. A name or email holding any of those, or another control character, therefore recorded a different author than the one asked for. WithAuthor now throws ArgumentException naming the value. The check lives in the builder rather than on GitAuthorName/GitAuthorEmail because those types also carry identities read back from history. Fixes #239 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016AQEMQSRnmweax4URvCpi3
Contributor
Author
|
GitHub returns 404 for the cancelled job's log, so I can't see which test it stopped in. I'm re-running the cancelled jobs once. If it hangs again, I'll treat the failure as real and look into it on this PR. Generated by Claude Code |
|
4 tasks
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.



Fixes #239
Summary
Commit().WithAuthor(name, email)now throwsArgumentExceptionwhen either value contains<,>or a control character (including\n,\r,\t,\0). The message names the bad value andParamNamesays which argument it was. git splits or strips these characters silently and exits 0, so the commit used to record a different author than the one asked for.GitAuthorName/GitAuthorEmail. Both types are also built byGitLogParserfrom identities read back out of history, and theGitAuthorEmailremarks say those must stay readable. A construction-time attribute would makeLog()throw on a crafted historical commit.Tests
RejectsAuthorValuesGitWouldRewrite: the three rows from the issue, plus>,\r,\0and control characters in the email. All 8 cases fail with the builder change reverted and pass with it.AcceptsOrdinaryAuthorValues:O'Brien, Jr.and non-ASCII names and emails are still passed through unchanged.CommitWithAuthorRecordsAnOrdinaryAuthorAsGivenAsync(integration, real git): the author read back from the commit matches the one requested.GitIntegration.Testsuite: 894 passed, 0 skipped.Generated by Claude Code