mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-10 15:42:16 +01:00
Fix duplicate co-author in squashed merge commit messages (#33020)
Fix: #31980 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit a87168869a4ceffb2a3d84986640da357b0793cf)
This commit is contained in:
parent
9b2f38261b
commit
af91f4e203
1 changed files with 5 additions and 1 deletions
|
@ -5,6 +5,7 @@ package pull
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
|
@ -66,7 +67,10 @@ func doMergeStyleSquash(ctx *mergeContext, message string) error {
|
|||
|
||||
if setting.Repository.PullRequest.AddCoCommitterTrailers && ctx.committer.String() != sig.String() {
|
||||
// add trailer
|
||||
message += fmt.Sprintf("\nCo-authored-by: %s\nCo-committed-by: %s\n", sig.String(), sig.String())
|
||||
if !strings.Contains(message, fmt.Sprintf("Co-authored-by: %s", sig.String())) {
|
||||
message += fmt.Sprintf("\nCo-authored-by: %s", sig.String())
|
||||
}
|
||||
message += fmt.Sprintf("\nCo-committed-by: %s\n", sig.String())
|
||||
}
|
||||
cmdCommit := git.NewCommand(ctx, "commit").
|
||||
AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email).
|
||||
|
|
Loading…
Reference in a new issue