@@ -401,10 +401,14 @@ func parseMessage(m string) (labels string, body string, ok bool) { // parsePSMessage parses an autogenerated:gerrit:newPatchSet // message and returns its body, if any. func parsePSMessage(m string, revisionNumber int) (body string, _ error) { // "Uploaded patch set ". if !strings.HasPrefix(m, "Uploaded patch set ") { if strings.HasPrefix(m, "Patch Set ") { // No body. Maybe just the commit message changed. return "", nil } return "", fmt.Errorf("unexpected format") } m = m[len("Uploaded patch set "):] // Revision number, e.g., "123".
@@ -60,10 +60,15 @@ func TestParsePSMessage(t *testing.T) { { inMessage: "Uploaded patch set 2.\n\n(3 comments)", inRevisionNumber: 2, wantBody: "(3 comments)", }, { inMessage: "Patch Set 3: Commit message was updated.", inRevisionNumber: 3, wantBody: "", }, { inMessage: "something unexpected", inRevisionNumber: 3, wantError: true, },