dmitri.shuralyov.com/website/gido/...

get CL subject via Subject method

I wasn't aware this method existed, that's why I wrote code
that does the same thing. Start using the Subject method now.
dmitshur committed 5 years ago commit 936a915e8b34147229aba3aafbf629d42e850fcf
Collapse all
service.go
@@ -235,11 +235,11 @@ func issuesAndChanges(repo *maintner.GitHubRepo, gerrit *maintner.Gerrit) map[st
			state, ok := clState(cl.Status)
			if !ok {
				return nil
			}

			prefixedTitle := firstParagraph(cl.Commit.Msg)
			prefixedTitle := cl.Subject()
			pkgs, title := ParsePrefixedChangeTitle(root, prefixedTitle)
			var labels []issues.Label
			cl.Meta.Hashtags().Foreach(func(name string) {
				labels = append(labels, issues.Label{
					Name:  name,
@@ -432,19 +432,10 @@ func ghState(issue *maintner.GitHubIssue) issues.State {
	default:
		panic("unreachable")
	}
}

// firstParagraph returns the first paragraph of text s.
func firstParagraph(s string) string {
	i := strings.Index(s, "\n\n")
	if i == -1 {
		return s
	}
	return s[:i]
}

func clState(status string) (_ change.State, ok bool) {
	switch status {
	case "new":
		return change.OpenState, true
	case "abandoned":