| 2934 | } |
| 2935 | |
| 2936 | bool Git::cancel(int64_t jobId) { |
| 2937 | #ifdef DORA_NO_WA |
| 2938 | DORA_UNUSED_PARAM(jobId); |
| 2939 | return false; |
| 2940 | #else // !DORA_NO_WA |
| 2941 | auto& gitHandles = handles(); |
| 2942 | auto it = gitHandles.find(jobId); |
| 2943 | if (it != gitHandles.end()) { |
| 2944 | auto handle = std::move(it->second); |
| 2945 | gitHandles.erase(it); |
| 2946 | bool canceled = WaGitCancel(jobId); |
| 2947 | std::string status = poll(jobId); |
| 2948 | if (!IsGitTerminalStatus(status)) { |
| 2949 | status = fmt::format( |
| 2950 | "{{\"id\":{},\"state\":\"canceled\",\"kind\":\"{}\",\"repoPath\":\"{}\",\"message\":\"canceled\"}}", |
| 2951 | jobId, |
| 2952 | EscapeJsonString(handle.kind), |
| 2953 | EscapeJsonString(handle.repoPath)); |
| 2954 | } |
| 2955 | handle.callback(status); |
| 2956 | dispose(jobId); |
| 2957 | return canceled; |
| 2958 | } |
| 2959 | return WaGitCancel(jobId); |
| 2960 | #endif // !DORA_NO_WA |
| 2961 | } |
| 2962 | |
| 2963 | bool Git::dispose(int64_t jobId) { |
| 2964 | #ifdef DORA_NO_WA |
nothing calls this directly
no test coverage detected