summaryrefslogtreecommitdiffstats
path: root/modules/base/tool.go
diff options
context:
space:
mode:
authorMatthias Loibl <mail@matthiasloibl.com>2016-11-07 21:36:01 +0100
committerMatthias Loibl <mail@matthiasloibl.com>2016-11-07 23:31:39 +0100
commit86c32f2706d9865194d06b8eec53727785d70567 (patch)
tree723017f57148d24d242ed5b889b482c018a50bd9 /modules/base/tool.go
parent030ba2894f3e9f9442b4bbf83fec09bda1ca88c5 (diff)
downloadgitea-86c32f2706d9865194d06b8eec53727785d70567.tar.gz
gitea-86c32f2706d9865194d06b8eec53727785d70567.zip
Use TruncateString(sha1,10) in ShortSha and deprecate it.
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r--modules/base/tool.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 9177cfe193..ab45dbae2f 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -42,11 +42,9 @@ func EncodeSha1(str string) string {
return hex.EncodeToString(h.Sum(nil))
}
+// ShortSha is basically just truncating. It is DEPRECATED and will be removed in the future.
func ShortSha(sha1 string) string {
- if len(sha1) > 10 {
- return sha1[:10]
- }
- return sha1
+ return TruncateString(sha1, 10)
}
func DetectEncoding(content []byte) (string, error) {