Skip to content

Use GitHub-style commit message for squash merge#35987

Merged
lunny merged 11 commits into
go-gitea:mainfrom
Zettat123:improve-squash-message
Nov 22, 2025
Merged

Use GitHub-style commit message for squash merge#35987
lunny merged 11 commits into
go-gitea:mainfrom
Zettat123:improve-squash-message

Conversation

@Zettat123
Copy link
Copy Markdown
Contributor

This PR modifies the commit message format for squash merge to match GitHub's style.

Screenshots

Before:

ddfd45324aebe5244bab363a807ee915

After:

47bd856598c94d5dedf73148f347e6ec

GitHub:

a72cf5adb41143dc587e3a706b7523e2

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 20, 2025
@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 Nov 20, 2025
@lunny lunny added this to the 1.26.0 milestone Nov 20, 2025
@lunny lunny added the type/enhancement An improvement of existing functionality label Nov 20, 2025
@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 Nov 20, 2025
Comment thread tests/integration/pull_merge_test.go Outdated
Comment on lines +1262 to +1273
expectedMessage: `* Refactor user service

Implement the login endpoint.
Validate request body.

* Add email notification service

Implements a new email notification module.

- Supports templating
- Supports HTML and plain text modes
- Includes retry logic
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it really a good result?

* Refactor user service
...
- Supports templating
* (others...)

Not sure whether GitHub does so. Even if GitHub does so, I don't think GitHub was right or we need to blindly follow GitHub

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't quite understand where the problem is. We add * before every commit message and - comes from the commit message content.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For example:

commit1:

a
* a
* c

commit2:

x
* y
* z

The current code generates:

* a
* b
* c
* x
* y
* z

It looks like there are 6 commits.

But ideally it should be:

* a
  * b
  * c
* x
  * y
  * z

Just my opinion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, GitHub does the same thing.

c7ede32e4a4b36236d0b4826d3045952

Using * in commit messages can make it difficult to distinguish between multiple messages. However, since the squash commit message is editable, I think that users can manually fix such issues if necessary.

@wxiaoguang
Copy link
Copy Markdown
Contributor

What's the difference of " Squash merge messages contain information about all commits by default. #35247 " ? Why 35247 seems more complex and changed more code.

@wxiaoguang wxiaoguang marked this pull request as draft November 20, 2025 06:16
Comment thread services/pull/pull.go Outdated
@Zettat123
Copy link
Copy Markdown
Contributor Author

What's the difference of " Squash merge messages contain information about all commits by default. #35247 " ? Why 35247 seems more complex and changed more code.

Gitea already supports including the commit messages of all commits for squash merge in #16134 and this behavior is controlled by the POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES option. It seems that #35247 makes it the default behavior, and it is no longer controlled by the option. I think we should keep this option and only modify the format.

Comment thread tests/integration/pull_merge_test.go Outdated
@wxiaoguang wxiaoguang marked this pull request as ready for review November 20, 2025 17:00
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 22, 2025
@GiteaBot

This comment was marked as outdated.

@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 22, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 22, 2025
@lunny lunny merged commit ed977d9 into go-gitea:main Nov 22, 2025
25 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 22, 2025
@wxiaoguang wxiaoguang deleted the improve-squash-message branch November 23, 2025 04:34
pimpale pushed a commit to hud-evals/gitea that referenced this pull request Dec 14, 2025
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Feb 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants