in server.go [226:258]
func checkCommitFooter(message, footer string) string {
if len(footer) == 0 {
return "required footer should be non-empty"
}
blocks := strings.Split(message, "\n\n")
if len(blocks) < 2 {
return "gerrit changes must have two paragraphs."
}
footerBlock := blocks[len(blocks)-1]
lines := strings.Split(footerBlock, "\n")
for _, l := range lines {
fields := strings.SplitN(l, ":", 2)
if len(fields) < 2 {
continue
}
if fields[0] != footer {
continue
}
value := fields[1]
if !strings.HasPrefix(value, " ") {
return fmt.Sprintf("footer %q should have space after ':'", fields[1])
}
// length limit?
return ""
}
return fmt.Sprintf("footer %q not found", footer)
}