no way to disable pull request description as default squash merge commit message details #14029

Open
opened 2025-11-02 11:00:41 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @trim21 on GitHub (Jan 22, 2025).

Feature Description

I'm trying to get gitea behavior like this github option:

Image

There is no same option in gitea so I try to use default merge message to achieve this.

The .gitea/default_merge_message/SQUASH_TEMPLATE.md allow users to override default squash message but gitea will always prepend pull request description as commit message details

for example, for pull request

fix: something

hello

and template .gitea/default_merge_message/SQUASH_TEMPLATE.md

${PullRequestTitle} (${PullRequestReference})

test

the default commit message details will always be

hello

test

instead of expected text only

Screenshots

Image

Originally created by @trim21 on GitHub (Jan 22, 2025). ### Feature Description I'm trying to get gitea behavior like this github option: ![Image](https://github.com/user-attachments/assets/59bf2194-502d-4d5a-bc0a-3d237d98fa59) There is no same option in gitea so I try to use default merge message to achieve this. The `.gitea/default_merge_message/SQUASH_TEMPLATE.md` allow users to override default squash message but gitea will always prepend pull request description as commit message details for example, for pull request ``` fix: something hello ``` and template `.gitea/default_merge_message/SQUASH_TEMPLATE.md` ```md ${PullRequestTitle} (${PullRequestReference}) test ``` the default commit message details will always be ``` hello test ``` instead of expected `text` only ### Screenshots ![Image](https://github.com/user-attachments/assets/3c8a9a1f-6d6b-4fa0-bad5-7d78fdf6e355)
GiteaMirror added the type/proposal label 2025-11-02 11:00:41 -06:00
Author
Owner

@yp05327 commented on GitHub (Jan 22, 2025):

Related: #20618
This PR break the default merge message template.
It seems that the commit message should be included in defaultSquashMergeMessage, not hard coding in template

@yp05327 commented on GitHub (Jan 22, 2025): Related: #20618 This PR break the default merge message template. It seems that the commit message should be included in `defaultSquashMergeMessage`, not hard coding in template
Author
Owner

@wxiaoguang commented on GitHub (Jan 23, 2025):

Related: #20618
This PR break the default merge message template.

Sorry but why it's related? I don't 20618 touched PullRequestReference or removed something related .........

@wxiaoguang commented on GitHub (Jan 23, 2025): > Related: [#20618](https://github.com/go-gitea/gitea/pull/20618) > This PR break the default merge message template. Sorry but why it's related? I don't `20618` touched PullRequestReference or removed something related .........
Author
Owner

@yp05327 commented on GitHub (Jan 23, 2025):

#20618 added GetCommitMessages to the squash merge message which is hard coding

Image

so no matter how end user change the defaultMergeMessage, it will always include GetCommitMessages.

If don't want to break the old design before 1.17.0, then commit message should be included in defaultSquashMergeMessage (which is called defaultMergeMessage before) instead of always showing it on the top?

Image

Another strange things is why GetCommitMessages equals the PR description message here.
I got the answer:
Image

@yp05327 commented on GitHub (Jan 23, 2025): #20618 added `GetCommitMessages` to the squash merge message which is hard coding ![Image](https://github.com/user-attachments/assets/5eb5909b-39b3-48df-b137-ea55445832e3) so no matter how end user change the `defaultMergeMessage`, it will always include `GetCommitMessages`. If don't want to break the old design before 1.17.0, then commit message should be included in `defaultSquashMergeMessage` (which is called `defaultMergeMessage` before) instead of always showing it on the top? ![Image](https://github.com/user-attachments/assets/b1c1ecab-2ff2-4c99-96d5-3241993963f8) ~~Another strange things is why `GetCommitMessages` equals the PR description message here.~~ I got the answer: ![Image](https://github.com/user-attachments/assets/150ae204-09c9-4f18-bd25-c845b13ebefe)
Author
Owner

@wxiaoguang commented on GitHub (Jan 23, 2025):

#20618 added GetCommitMessages to the squash merge message which is hard coding

TBH it is a bug fix but not a breaking change: https://github.com/go-gitea/gitea/pull/20618#issuecomment-1203017798 .

If I understand correctly, it is a quite old behavior (add commit messages) since Provide Default messages for merges (#9393)

@wxiaoguang commented on GitHub (Jan 23, 2025): > [#20618](https://github.com/go-gitea/gitea/pull/20618) added `GetCommitMessages` to the squash merge message which is hard coding TBH it is a bug fix but not a breaking change: https://github.com/go-gitea/gitea/pull/20618#issuecomment-1203017798 . If I understand correctly, it is a quite old behavior (add commit messages) since Provide Default messages for merges (#9393) * https://github.com/go-gitea/gitea/pull/9393/files#diff-7f25271f6c80f878fdb80a556b5fb2066352bc24d79736b32215205b5fc908c4R197
Author
Owner

@yp05327 commented on GitHub (Jan 23, 2025):

So this can be improved now?

  • add a variable for commit messages
  • by default, it will show commit message/PR content which will not break the old behavior
  • user can completely change the default squash message by using the template
@yp05327 commented on GitHub (Jan 23, 2025): So this can be improved now? - add a variable for commit messages - by default, it will show commit message/PR content which will not break the old behavior - user can completely change the default squash message by using the template
Author
Owner

@trim21 commented on GitHub (Jan 23, 2025):

there should be variable PullRequestBody or something so users can add it when they want it and avoid it when they do not want it.

@trim21 commented on GitHub (Jan 23, 2025): there should be variable `PullRequestBody` or something so users can add it when they want it and avoid it when they do not want it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14029