From f6094a8c64442f7933534128c20f03b726cfed5d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 21 Mar 2019 09:28:25 +0100 Subject: dashboard/app: use 12-char hash in Fixes tags @ebiggers pointed out that Fixes tags should use 12-char hash: https://groups.google.com/d/msg/syzkaller-bugs/yUhRrLD6T6A/3TMwOWvWAgAJ I can't find any documentation on this, but it looks like most existing tags follow this convention so use 12-char hashes. --- pkg/html/html.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg/html') diff --git a/pkg/html/html.go b/pkg/html/html.go index a07de81d2..1c48f6d51 100644 --- a/pkg/html/html.go +++ b/pkg/html/html.go @@ -47,6 +47,7 @@ var Funcs = template.FuncMap{ "formatReproLevel": formatReproLevel, "formatStat": formatStat, "formatShortHash": formatShortHash, + "formatTagHash": formatTagHash, "formatCommitTableTitle": formatCommitTableTitle, "formatList": formatStringList, } @@ -142,6 +143,15 @@ func formatShortHash(v string) string { return v[:hashLen] } +func formatTagHash(v string) string { + // Note: Fixes/References commit tags should include 12-char hash. Don't change this const. + const hashLen = 12 + if len(v) <= hashLen { + return v + } + return v[:hashLen] +} + func formatCommitTableTitle(v string) string { // This function is very specific to how we format tables in text emails. // Truncate commit title so that whole line fits into 78 chars. -- cgit mrf-deployment