@@ -416,15 +416,27 @@ func parsePSMessage(m string, revisionNumber int) (body string, _ error) { if i == -1 { return "", fmt.Errorf("unexpected format") } m = m[i:] switch { // ".". if len(m) < 1 || m[0] != '.' { case len(m) >= 1 && m[0] == '.': m = m[1:] // ":". case len(m) >= 1 && m[0] == ':': m = m[1:] // " Run-TryBot+1." i := strings.IndexByte(m, '.') if i == -1 { return "", fmt.Errorf("unexpected format") } m = m[i+1:] default: return "", fmt.Errorf("unexpected format") } m = m[1:] if m == "" { // No body. return "", nil }
@@ -65,10 +65,20 @@ func TestParsePSMessage(t *testing.T) { { inMessage: "Patch Set 3: Commit message was updated.", inRevisionNumber: 3, wantBody: "", }, { inMessage: "Uploaded patch set 4: Run-TryBot+1.\n\n(1 comment)", inRevisionNumber: 4, wantBody: "(1 comment)", }, { inMessage: "Uploaded patch set 5: Run-TryBot+1.", inRevisionNumber: 5, wantBody: "", }, { inMessage: "something unexpected", inRevisionNumber: 3, wantError: true, },