| 350 | } |
| 351 | |
| 352 | static bool watcher_resolve_git_executable(char output[CBM_SZ_4K]) { |
| 353 | output[0] = '\0'; |
| 354 | DWORD required = GetEnvironmentVariableW(L"PATH", NULL, 0U); |
| 355 | wchar_t *path = required > 0U ? malloc((size_t)required * sizeof(*path)) : NULL; |
| 356 | DWORD length = path ? GetEnvironmentVariableW(L"PATH", path, required) : 0U; |
| 357 | if (!path || length == 0U || length >= required) { |
| 358 | free(path); |
| 359 | return false; |
| 360 | } |
| 361 | const wchar_t *entry = path; |
| 362 | for (const wchar_t *cursor = path;; cursor++) { |
| 363 | if (*cursor != L';' && *cursor != L'\0') { |
| 364 | continue; |
| 365 | } |
| 366 | if (watcher_windows_git_candidate(entry, (size_t)(cursor - entry), output)) { |
| 367 | free(path); |
| 368 | return true; |
| 369 | } |
| 370 | if (*cursor == L'\0') { |
| 371 | break; |
| 372 | } |
| 373 | entry = cursor + 1; |
| 374 | } |
| 375 | free(path); |
| 376 | return false; |
| 377 | } |
| 378 | #endif |
| 379 | |
| 380 | /* Run one literal argv vector in a contained process tree. active_git is |
no test coverage detected