Skip to content

Extract Co-authored-by trailers from messages when squashing commits#769

Merged
Kobzol merged 1 commit into
rust-lang:mainfrom
cuba0001:amstepanov/squash-coauthored-trailers
Jun 19, 2026
Merged

Extract Co-authored-by trailers from messages when squashing commits#769
Kobzol merged 1 commit into
rust-lang:mainfrom
cuba0001:amstepanov/squash-coauthored-trailers

Conversation

@cuba0001

Copy link
Copy Markdown
Contributor

Fixes #768

@cuba0001

Copy link
Copy Markdown
Contributor Author

There is one implementation detail worth noting. To keep it simple, we iterate over the commits twice. The first pass is needed when generating the default squash commit message, if no custom @bors squash msg="..." message was specified. In that case, we strip existing Co-authored-by trailers from the original commit messages. Otherwise they would stay in the generated body and then be added again to the final trailer block. I think this is fine for up to 250 commits, which is the current upper bound, but please let me know if you would prefer this to be done in a single pass.

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it looks great! Two passes are fine. I left a few minor comments.

View changes since this review

Comment thread src/bors/handlers/squash.rs
Comment thread src/bors/handlers/squash.rs Outdated
Comment thread src/bors/handlers/squash.rs Outdated
Comment thread src/bors/handlers/squash.rs Outdated
Comment thread src/bors/handlers/squash.rs
@cuba0001 cuba0001 force-pushed the amstepanov/squash-coauthored-trailers branch from 200e171 to 36c9fb2 Compare June 19, 2026 11:34

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks great! :)

View changes since this review

@Kobzol Kobzol added this pull request to the merge queue Jun 19, 2026
Merged via the queue into rust-lang:main with commit 511bef8 Jun 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scan existing "Co-authored-by" records when squashing a commit

2 participants