mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Remove Unused Functions (#10516)
* remove ReplaceLeft * remove GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName * remove CheckUnitUser chainload to models.CheckUnitUser * remove MakeAssigneeList * remove DownloadDiff & DownloadPatch -> DownloadDiffOrPatch * remove GetRandomBytesAsBase64 * remove PushUpdateDeleteTags * remove GetUserByKeyID (you still can resolve user by "k, err := GetPublicKeyByID; userID := k.OwnerID") * remove BasicAuthEncode from struct package -> same function in modules/base/tools ! * remove UserID from api.utils * remove unused func from structs package
This commit is contained in:
		| @@ -437,31 +437,6 @@ func Sha1(str string) string { | ||||
| 	return base.EncodeSha1(str) | ||||
| } | ||||
|  | ||||
| // ReplaceLeft replaces all prefixes 'oldS' in 's' with 'newS'. | ||||
| func ReplaceLeft(s, oldS, newS string) string { | ||||
| 	oldLen, newLen, i, n := len(oldS), len(newS), 0, 0 | ||||
| 	for ; i < len(s) && strings.HasPrefix(s[i:], oldS); n++ { | ||||
| 		i += oldLen | ||||
| 	} | ||||
|  | ||||
| 	// simple optimization | ||||
| 	if n == 0 { | ||||
| 		return s | ||||
| 	} | ||||
|  | ||||
| 	// allocating space for the new string | ||||
| 	curLen := n*newLen + len(s[i:]) | ||||
| 	replacement := make([]byte, curLen) | ||||
|  | ||||
| 	j := 0 | ||||
| 	for ; j < n*newLen; j += newLen { | ||||
| 		copy(replacement[j:j+newLen], newS) | ||||
| 	} | ||||
|  | ||||
| 	copy(replacement[j:], s[i:]) | ||||
| 	return string(replacement) | ||||
| } | ||||
|  | ||||
| // RenderCommitMessage renders commit message with XSS-safe and special links. | ||||
| func RenderCommitMessage(msg, urlPrefix string, metas map[string]string) template.HTML { | ||||
| 	return RenderCommitMessageLink(msg, urlPrefix, "", metas) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user