From 5212d20efd8101b68bcd97be498f97c019a795b7 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 24 Jan 2023 11:28:36 -0500 Subject: [PATCH] Test minimization resumption first Otherwise, resumption will be parsed as an option. --- src/bot.ml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/bot.ml b/src/bot.ml index 54a33f58..0af7c9a6 100644 --- a/src/bot.ml +++ b/src/bot.ml @@ -305,8 +305,12 @@ let callback _conn req body = Server.respond_string ~status:`OK ~body:"Handling minimization." () | None -> ( - match coqbot_ci_minimize_text_of_body body with - | Some (options, requests) -> + (* Since both ci minimization resumption and ci + minimization will match the resumption string, and we + don't want to parse "resume" as an option, we test + resumption first *) + match coqbot_resume_ci_minimize_text_of_body body with + | Some (options, requests, bug_file_contents) -> (fun () -> init_git_bare_repository ~bot_info >>= fun () -> @@ -314,13 +318,13 @@ let callback _conn req body = ~owner:comment_info.issue.issue.owner ~repo:comment_info.issue.issue.repo (ci_minimize ~comment_info ~requests ~comment_on_error:true - ~options ~bug_file_contents:None ) ) + ~options ~bug_file_contents:(Some bug_file_contents) ) ) |> Lwt.async ; Server.respond_string ~status:`OK - ~body:"Handling CI minimization." () + ~body:"Handling CI minimization resumption." () | None -> ( - match coqbot_resume_ci_minimize_text_of_body body with - | Some (options, requests, bug_file_contents) -> + match coqbot_ci_minimize_text_of_body body with + | Some (options, requests) -> (fun () -> init_git_bare_repository ~bot_info >>= fun () -> @@ -328,11 +332,11 @@ let callback _conn req body = ~owner:comment_info.issue.issue.owner ~repo:comment_info.issue.issue.repo (ci_minimize ~comment_info ~requests - ~comment_on_error:true ~options - ~bug_file_contents:(Some bug_file_contents) ) ) + ~comment_on_error:true ~options ~bug_file_contents:None ) + ) |> Lwt.async ; Server.respond_string ~status:`OK - ~body:"Handling CI minimization resumption." () + ~body:"Handling CI minimization." () | None -> if string_match