From 51be54e32f361c59569717433695d7e4ebf6a201 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Sat, 4 Oct 2014 14:18:41 +1000 Subject: [PATCH] go.tools/dashboard/app: show main repo commits with no build results The UI template iterates over ResultGoHashes to display the Commit rows. This was done for the sub-repository build view, where it only makes sense to show a row when there's build data for it. However, in the main page UI we do want to see if a commit has hit the dashboard but has not yet been built. This change causes the dashboard to show the commit row even if there are no build results for it yet. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/153010043 --- dashboard/app/build/build.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dashboard/app/build/build.go b/dashboard/app/build/build.go index 42112ad6..d8677a6f 100644 --- a/dashboard/app/build/build.go +++ b/dashboard/app/build/build.go @@ -215,6 +215,12 @@ func (c *Commit) Results() (results []*Result) { } func (c *Commit) ResultGoHashes() []string { + // For the main repo, just return the empty string + // (there's no corresponding main repo hash for a main repo Commit). + // This function is only really useful for sub-repos. + if c.PackagePath == "" { + return []string{""} + } var hashes []string for _, r := range c.ResultData { p := strings.SplitN(r, "|", 4)