mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-23 14:38:01 +02:00
* Fix #3321: commit tag shortener * Check short commit * remove debug * Edit unit tests * Show 10-char short SHA
This commit is contained in:
@ -45,7 +45,7 @@ func EncodeSha1(str string) string {
|
||||
}
|
||||
|
||||
func ShortSha(sha1 string) string {
|
||||
if len(sha1) == 40 {
|
||||
if len(sha1) > 10 {
|
||||
return sha1[:10]
|
||||
}
|
||||
return sha1
|
||||
|
@ -90,7 +90,7 @@ var (
|
||||
IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`)
|
||||
|
||||
// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae
|
||||
Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{40}\b`)
|
||||
Sha1CurrentPattern = regexp.MustCompile(`\b[0-9a-f]{7,40}\b`)
|
||||
)
|
||||
|
||||
// FindAllMentions matches mention patterns in given content
|
||||
|
Reference in New Issue
Block a user