| 285 | } |
| 286 | |
| 287 | static bool watcher_resolve_git_executable(char output[CBM_SZ_4K]) { |
| 288 | output[0] = '\0'; |
| 289 | DWORD required = GetEnvironmentVariableW(L"PATH", NULL, 0U); |
| 290 | wchar_t *path = required > 0U ? malloc((size_t)required * sizeof(*path)) : NULL; |
| 291 | DWORD length = path ? GetEnvironmentVariableW(L"PATH", path, required) : 0U; |
| 292 | if (!path || length == 0U || length >= required) { |
| 293 | free(path); |
| 294 | return false; |
| 295 | } |
| 296 | const wchar_t *entry = path; |
| 297 | for (const wchar_t *cursor = path;; cursor++) { |
| 298 | if (*cursor != L';' && *cursor != L'\0') { |
| 299 | continue; |
| 300 | } |
| 301 | if (watcher_windows_git_candidate(entry, (size_t)(cursor - entry), output)) { |
| 302 | free(path); |
| 303 | return true; |
| 304 | } |
| 305 | if (*cursor == L'\0') { |
| 306 | break; |
| 307 | } |
| 308 | entry = cursor + 1; |
| 309 | } |
| 310 | free(path); |
| 311 | return false; |
| 312 | } |
| 313 | #endif |
| 314 | |
| 315 | /* Run one literal argv vector in a contained process tree. active_git is |
no test coverage detected