diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-10-01 13:34:16 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-10-01 15:03:39 +0200 |
| commit | 8441eb82f3a1a4d03eb0e194e91bc86017ab4466 (patch) | |
| tree | 848c8b52ed52b775c87ea9d726680743f2bd3332 /pkg/email/parser.go | |
| parent | 1170210d9cb103aa346ce7260db1c1819cb3c41f (diff) | |
dashboard/app: add unfix command
Add "#syz unfix" command that undoes "#syz fix" effects
and resets any existing fixing commits.
Diffstat (limited to 'pkg/email/parser.go')
| -rw-r--r-- | pkg/email/parser.go | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/pkg/email/parser.go b/pkg/email/parser.go index 589598ba2..df7cc4717 100644 --- a/pkg/email/parser.go +++ b/pkg/email/parser.go @@ -38,6 +38,7 @@ const ( CmdNone CmdUpstream CmdFix + CmdUnFix CmdDup CmdUnDup CmdTest @@ -223,28 +224,7 @@ func extractCommand(body string) (cmd Command, str, args string) { cmdEnd = cmdEnd1 } str = body[cmdPos : cmdPos+cmdEnd] - switch str { - default: - cmd = CmdUnknown - case "": - cmd = CmdNone - case "upstream": - cmd = CmdUpstream - case "fix", "fix:": - cmd = CmdFix - case "dup", "dup:": - cmd = CmdDup - case "undup": - cmd = CmdUnDup - case "test", "test:": - cmd = CmdTest - case "invalid": - cmd = CmdInvalid - case "uncc", "uncc:": - cmd = CmdUnCC - case "test_5_arg_cmd": - cmd = cmdTest5 - } + cmd = strToCmd(str) // Some email clients split text emails at 80 columns are the transformation is irrevesible. // We try hard to restore what was there before. // For "test:" command we know that there must be 2 tokens without spaces. @@ -260,6 +240,33 @@ func extractCommand(body string) (cmd Command, str, args string) { return } +func strToCmd(str string) Command { + switch str { + default: + return CmdUnknown + case "": + return CmdNone + case "upstream": + return CmdUpstream + case "fix", "fix:": + return CmdFix + case "unfix": + return CmdUnFix + case "dup", "dup:": + return CmdDup + case "undup": + return CmdUnDup + case "test", "test:": + return CmdTest + case "invalid": + return CmdInvalid + case "uncc", "uncc:": + return CmdUnCC + case "test_5_arg_cmd": + return cmdTest5 + } +} + func extractArgsTokens(body string, num int) string { var args []string for pos := 0; len(args) < num && pos < len(body); { |
