| 2317 | } |
| 2318 | |
| 2319 | static bool impact_test_git(const char *root, const char *const *args) { |
| 2320 | const char *git = "git"; |
| 2321 | #ifdef _WIN32 |
| 2322 | char git_path[1024]; |
| 2323 | const char *resolved = cbm_find_cli("git", NULL); |
| 2324 | if (!resolved || !*resolved || strlen(resolved) >= sizeof(git_path)) |
| 2325 | return false; |
| 2326 | snprintf(git_path, sizeof(git_path), "%s", resolved); |
| 2327 | git = git_path; |
| 2328 | #endif |
| 2329 | const char *argv[30] = {git, |
| 2330 | "-C", |
| 2331 | root, |
| 2332 | "-c", |
| 2333 | "user.name=Impact fixture", |
| 2334 | "-c", |
| 2335 | "user.email=fixture@localhost", |
| 2336 | "-c", |
| 2337 | "commit.gpgsign=false"}; |
| 2338 | int n = 9; |
| 2339 | while (*args && n < 29) |
| 2340 | argv[n++] = *args++; |
| 2341 | cbm_proc_opts_t opts = { |
| 2342 | .bin = git, .argv = argv, .quiet_timeout_ms = 3000, .strip_git_repo_env = true}; |
| 2343 | cbm_proc_result_t result; |
| 2344 | return cbm_subprocess_run(&opts, &result) == 0 && result.outcome == CBM_PROC_CLEAN; |
| 2345 | } |
| 2346 | |
| 2347 | static bool impact_test_write(const char *root, const char *file, const char *value) { |
| 2348 | char path[1024]; |
no test coverage detected