Closed bradfitz closed 6 years ago
/cc @dmitshur
This seems to happen when the CL description mentions the same issue more than once. For example, here's a current occurrence of this bug:
Here's the commit message of CL 26650 mentioning that issue twice:
Seems like a straightforward bug to fix; I'll use it as a warm up.
maintner.GerritCL
has a field GitHubIssueRefs
of type []GitHubIssueRef
. Currently, if the CL description mentions the same issue more than once, there will be multiple identical GitHubIssueRef
entries in that slice. E.g.:
corpus, err := godata.Get(context.Background())
if err != nil {
return err
}
proj := corpus.Gerrit().Project("go.googlesource.com", "sys")
cl := proj.CL(26650)
for _, ref := range cl.GitHubIssueRefs {
fmt.Println(ref.Repo.ID(), ref.Number)
}
// Output:
// golang/go 14873
// golang/go 14873
While it's possible to deduplicate these lines in devapp-only, I suspect a better fix is to deduplicate them in maintner
.
(At least at this time, GitHubIssueRef
doesn't track anything other than repo and issue number, so multiple entries carry very little information. If we ever want to change that to also have a "character position" or something to make multiple entries non-unique, then we can stop deduplicating.)
Change https://golang.org/cl/128119 mentions this issue: maintner: deduplicate issue references in parseGithubRefs
I've deployed the new version and confirmed that the bug is fixed in production.
I just noticed duplicate lines for an open CL: