Remove Claude/Codex attribution blocks and Claude-Session lines
Co-author cleanup now removes a Claude or Codex Co-authored-by line together with the non-blank lines that follow it, removes any Claude-Session trailer line, and collapses the blank lines left behind. Other Co-authored-by lines are still removed individually.
This commit is contained in:
@@ -178,6 +178,17 @@ func TestApplyChangesUpdatesDatesAndRemovesCoAuthorTrailers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveCoAuthorLinesDropsAIAttributionBlocks(t *testing.T) {
|
||||
message := "subject\n\nClaude-Session: https://example.com/a\nbody\n\nCo-authored-by: Ada <ada@example.com>\nSigned-off-by: Bob <bob@example.com>\n\nCo-Authored-By: Claude Opus 5 <noreply@anthropic.com>\nClaude-Session: https://example.com/b\nSomething else\n\nCo-authored-by: Codex <codex@openai.com>\nGenerated by Codex\n\ntail"
|
||||
cleaned, removed := removeCoAuthorLines(message)
|
||||
if removed != 7 {
|
||||
t.Fatalf("expected seven removed lines, got %d", removed)
|
||||
}
|
||||
if cleaned != "subject\n\nbody\n\nSigned-off-by: Bob <bob@example.com>\n\ntail" {
|
||||
t.Fatalf("unexpected cleaned message: %q", cleaned)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveCoAuthorLinesOnlyMatchesWholeTrailerLines(t *testing.T) {
|
||||
message := "subject\r\n\r\nCo-authored-by: Ada <ada@example.com>\r\n CO-AUTHORED BY: Grace <grace@example.com>\r\nNote: Co-authored-by: this is prose"
|
||||
cleaned, removed := removeCoAuthorLines(message)
|
||||
|
||||
Reference in New Issue
Block a user