Skip to content

PR UI doesn't reflect updated merge commit template in PR #34635

Open
@kazarmy

Description

@kazarmy

Description

After updating the merge commit template in a PR (via changing .gitea/default_merge_message/MERGE_TEMPLATE.md in a repo), I expect that the PR web UI immediately reflects this change after I press the "Create merge commit" button in the screenshot below. Instead, I have to commit the PR first, and if I get it wrong, I have to do another PR.

Looking at the code, it appears that the relevant code is:

templateFilepath := fmt.Sprintf(".gitea/default_merge_message/%s_TEMPLATE.md", strings.ToUpper(string(mergeStyle)))
commit, err := baseGitRepo.GetBranchCommit(pr.BaseRepo.DefaultBranch)
if err != nil {
return "", "", err
}
templateContent, err := commit.GetFileContent(templateFilepath, setting.Repository.PullRequest.DefaultMergeMessageSize)

and that the fix involves retrieving the template from the head repo rather than the base repo. This doesn't appear to be a difficult fix (assuming that there are no design issues) but I currently do not know enough Gitea (and Go) to be certain.

Gitea Version

1.23.8

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Image

Git Version

2.46.2.windows.1

Operating System

Windows 11

How are you running Gitea?

gitea-1.23.8-windows-4.0-amd64.exe as a Windows service

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions