Skip to content

Add option/templates to configure automatic commit messages #11509

Open
@MarkusAmshove

Description

@MarkusAmshove
  • 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 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions