Add option/templates to configure automatic commit messages #5428

Open
opened 2025-11-02 06:24:39 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @markusamshove on GitHub (May 19, 2020).

  • Gitea version (or commit ref): 1.12.0-rc1
  • Git version: 2.20.1
  • Operating system: Debian 10
  • Database (use [x]):
    • SQLite

Description

We currently employ a pre-receive hook to check commit messages for mentions of a mandatory issue tracker id and otherwise reject commits.

The mandatory form we're using is: "Issue #{issueid}: {message}".

I'm going to show off two places where this bites (or will bite) us, there might however be a few more around Gitea.

Merge messages

This is one place where this is a bit annoying but can be worked around:

image

See that the title of the PR is already formed into a commit message which would be valid, so we can copy paste it into the merge box.
However, if someone messes this up (which is easy, e.g. when facing the PR workflow the first few times), we get an invalid message.

In this place I could think of a simple template as in {{ .pull.title }} (pseudocode).

Update Branch

This is pretty new, that's the reason why I'm using the RC :-)

If I use the new "Update branch" button (which I can't seem to disable) I'm not prompted for a message:

image

Gitea is creating an automatic merge message which is invalid to our expected commit messages:

image

In this case, a template I would use is in the form of Issue #{{.head.branch_name}}: Merge branch '{{.base.branch}}' into {{.head.branch_name}} (also Pseudocode)

This place in particular was mentioned in the discussion of the Update branch button

While the branch protection for outdated branches (against their base) and the mention of it in the PR will be super helpful and a welcoming addition for us, the Update branch button (which can't be disabled by option) is dangerous in our case :-)

Originally created by @markusamshove on GitHub (May 19, 2020). - Gitea version (or commit ref): 1.12.0-rc1 - Git version: 2.20.1 - Operating system: Debian 10 - Database (use `[x]`): - [x] SQLite ## Description We currently employ a pre-receive hook to check commit messages for mentions of a mandatory issue tracker id and otherwise reject commits. The mandatory form we're using is: "Issue #{issueid}: {message}". I'm going to show off two places where this bites (or will bite) us, there might however be a few more around Gitea. ## Merge messages This is one place where this is a bit annoying but can be worked around: ![image](https://user-images.githubusercontent.com/2401875/82327239-6553c680-99de-11ea-9843-74c67e6d194e.png) See that the title of the PR is already formed into a commit message which would be valid, so we can copy paste it into the merge box. However, if someone messes this up (which is easy, e.g. when facing the PR workflow the first few times), we get an invalid message. In this place I could think of a simple template as in `{{ .pull.title }}` (pseudocode). ## Update Branch This is pretty new, that's the reason why I'm using the RC :-) If I use the new "Update branch" button (which I can't seem to disable) I'm not prompted for a message: ![image](https://user-images.githubusercontent.com/2401875/82327583-e7dc8600-99de-11ea-8732-26e5d2d29b3d.png) Gitea is creating an automatic merge message which is invalid to our expected commit messages: ![image](https://user-images.githubusercontent.com/2401875/82327686-0e9abc80-99df-11ea-9e7d-25919025e47a.png) In this case, a template I would use is in the form of `Issue #{{.head.branch_name}}: Merge branch '{{.base.branch}}' into {{.head.branch_name}}` (also Pseudocode) This place in particular was mentioned in the [discussion of the Update branch button](https://github.com/go-gitea/gitea/pull/9784#discussion_r367765097) While the branch protection for outdated branches (against their base) and the mention of it in the PR will be super helpful and a welcoming addition for us, the `Update branch` button (which can't be disabled by option) is dangerous in our case :-)
GiteaMirror added the type/proposal label 2025-11-02 06:24:39 -06:00
Author
Owner

@markusamshove commented on GitHub (May 29, 2020):

@lafriks could you label this issue? :-)

@markusamshove commented on GitHub (May 29, 2020): @lafriks could you label this issue? :-)
Author
Owner

@lunny commented on GitHub (Feb 10, 2022):

related with #18177

@lunny commented on GitHub (Feb 10, 2022): related with #18177
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5428