Skip to content

Set the user who creates web commit as its author

Igor Drozdov requested to merge id-add-co-authored-trailer-to-web-commits into master

What does this MR do and why?

With introducing Automated/web commits (merge or web IDE commits... (#19185 - closed), we're also changing the Committer of the web commits. The commits are going to be created by GitLab on behalf of the user. The Committer field will now contain GitLab <noreply@gitlab.com>.

It causes issues with the existing behavior of cherry-picks and suggestions: the created commits store the author of the original commit in the Author field and the user who performs the action in the Committer field. When the Committer field is replaced by GitLab <noreply@gitlab.com>, the committer data is lost.

Proposal

This MR changes this behavior. Now the user who performs the action is stored in the Author field. And the Author of the original content is credited in the Co-authored-by trailer.

Cherry-pick

User A cherry picks or reverts the commit authored by User B:

Before
Author: User B <>
Committer: User A <>
Now (with signing)
Author: User A <>
Committer: GitLab <>

Co-authored-by: User B <>

Requires Gitaly changes: https://gitlab.com/gitlab-org/gitaly/-/blob/8f58bcf44a107bf1874cb180c8592d9d53f73848/internal/gitaly/service/operations/cherry_pick.go#L105-119

Revert

The current behavior is acceptable without any additional changes:

User A revert the commit of User B

Before
Author: User A <>
Committer: User A <>
Now (with signing)
Author: User A <>
Committer: GitLab <>

Suggestions

The suggestions have a similar behavior but the Co-authored-by trailer can be configured by Merge suggestions template. If %{co_authored_by} is specified in the template:

Before

User A applies suggestions all authored by User B

Author: User B <>
Committer: User A <>

User A applies multiple suggestion from different users:

Author: User A <>
Committer: User A <>
Now (with signing)

User A applies suggestions all authored by User B

Author: User A <>
Committer: GitLab <>

Co-authored-by: User B <>

User A applies multiple suggestion from different users:

Author: User A <>
Committer: GitLab <>

Co-authored-by: User B <>
Co-authored-by: User C <>
Co-authored-by: User D <>
Edited by Igor Drozdov

Merge request reports