MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / watcher_resolve_git_executable

Function watcher_resolve_git_executable

src/watcher/watcher.c:352–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352static 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

Callers 1

watcher_git_runFunction · 0.85

Calls 1

Tested by

no test coverage detected