mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Refactor parseSignatureFromCommitLine (#29054)
Replace #28849. Thanks to @yp05327 for the looking into the problem. Fix #28840 The old behavior of newSignatureFromCommitline is not right. The new parseSignatureFromCommitLine: 1. never fails 2. only accept one format (if there is any other, it could be easily added) And add some tests.
This commit is contained in:
		| @@ -7,6 +7,8 @@ import ( | ||||
| 	"bytes" | ||||
| 	"sort" | ||||
| 	"strings" | ||||
|  | ||||
| 	"code.gitea.io/gitea/modules/util" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| @@ -59,11 +61,7 @@ l: | ||||
| 				// A commit can have one or more parents | ||||
| 				tag.Type = string(line[spacepos+1:]) | ||||
| 			case "tagger": | ||||
| 				sig, err := newSignatureFromCommitline(line[spacepos+1:]) | ||||
| 				if err != nil { | ||||
| 					return nil, err | ||||
| 				} | ||||
| 				tag.Tagger = sig | ||||
| 				tag.Tagger = parseSignatureFromCommitLine(util.UnsafeBytesToString(line[spacepos+1:])) | ||||
| 			} | ||||
| 			nextline += eol + 1 | ||||
| 		case eol == 0: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user