Skip to content

fix(pull): preserve squash message trailers and additional commit messages#37954

Merged
bircni merged 10 commits into
mainfrom
fix/squash-merge-commit-messages
Jun 15, 2026
Merged

fix(pull): preserve squash message trailers and additional commit messages#37954
bircni merged 10 commits into
mainfrom
fix/squash-merge-commit-messages

Conversation

@bircni

@bircni bircni commented May 31, 2026

Copy link
Copy Markdown
Member

…sages

When a PR description already ends with git trailers (e.g. Issue: X,
Signed-off-by:), the co-author separator line (---------)  was still
inserted before the Co-authored-by lines, breaking the trailer block.
messageHasTrailers now skips the separator so co-authors are appended
directly into the existing trailer block.

In PR-description mode (PopulateSquashCommentWithCommitMessages=false),
commit messages beyond the oldest were silently dropped. They are now
appended as bullet points after the PR description, consistent with the
commit-message mode format.

The commit-message loop is extracted into formatSquashMergeCommitMessages.
Callers that want to skip the oldest commit pass a trimmed slice
(commits[:max(0, len(commits)-1)]) instead of a skipFirst bool flag.

Co-Authored-By: Nicolas <nicolas@bircks.eu>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 31, 2026
Comment thread services/pull/pull.go Outdated
Comment thread services/pull/pull_test.go Outdated
@bircni bircni requested a review from wxiaoguang May 31, 2026 11:04
@wxiaoguang wxiaoguang marked this pull request as draft May 31, 2026 11:26
@wxiaoguang wxiaoguang removed their request for review May 31, 2026 11:26
Comment thread services/pull/pull_test.go Outdated
Comment thread services/pull/pull_test.go Outdated
@wxiaoguang

Copy link
Copy Markdown
Contributor

I would say half of the changed code is AI garbage, do you agree?

Comment thread services/pull/pull.go Outdated
@wxiaoguang

Copy link
Copy Markdown
Contributor

OK, rewritten.

And that's why I introduced CommitMessageSplitTrailer in feat: Add avatar stacks (#37594)

@wxiaoguang wxiaoguang marked this pull request as ready for review June 15, 2026 07:28
@wxiaoguang wxiaoguang added this to the 1.27.0 milestone Jun 15, 2026
@wxiaoguang

Copy link
Copy Markdown
Contributor

By the way, if you are a new contributor and not familiar with the code base, it's fine to just submit the AI PRs.

But I think you have been working on the code base for a long time and is an active maintainer, so I think you should pay more attention to the logic, fully understand the problem, carefully design, and avoid AI hallucination.

I really don't have time to keep fixing the AI slop.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 15, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 15, 2026
@bircni

bircni commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Sorry just did not have the time yet to continue and fix - will do it better

@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 15, 2026
@bircni bircni enabled auto-merge (squash) June 15, 2026 17:13
@bircni bircni merged commit 7997c1c into main Jun 15, 2026
29 checks passed
@bircni bircni deleted the fix/squash-merge-commit-messages branch June 15, 2026 17:55
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"---------" added to squash commit message, breaks existing trailers

4 participants