mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Backport #34512 by tclin914 If the message from form.MergeMessageField is empty, we will miss a "\n" between the title and the "Co-authored-by:" line. The title and message should have a blank line between of them. Co-authored-by: Jim Lin <jim@andestech.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -5,7 +5,6 @@ package pull | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	repo_model "code.gitea.io/gitea/models/repo" | ||||
| 	user_model "code.gitea.io/gitea/models/user" | ||||
| @@ -66,10 +65,8 @@ func doMergeStyleSquash(ctx *mergeContext, message string) error { | ||||
|  | ||||
| 	if setting.Repository.PullRequest.AddCoCommitterTrailers && ctx.committer.String() != sig.String() { | ||||
| 		// add trailer | ||||
| 		if !strings.Contains(message, "Co-authored-by: "+sig.String()) { | ||||
| 			message += "\nCo-authored-by: " + sig.String() | ||||
| 		} | ||||
| 		message += fmt.Sprintf("\nCo-committed-by: %s\n", sig.String()) | ||||
| 		message = AddCommitMessageTailer(message, "Co-authored-by", sig.String()) | ||||
| 		message = AddCommitMessageTailer(message, "Co-committed-by", sig.String()) // FIXME: this one should be removed, it is not really used or widely used | ||||
| 	} | ||||
| 	cmdCommit := git.NewCommand("commit"). | ||||
| 		AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email). | ||||
|   | ||||
		Reference in New Issue
	
	Block a user