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

Function git_tracks_anything_here

src/watcher/watcher.c:478–494  ·  view source on GitHub ↗

Does the ancestor repository actually track anything inside this directory? * Emptiness distinguishes "a scratch folder that merely sits under a repo" from * "a genuine subdirectory of one". Output is capped: we only care whether the * first byte exists, never what it is. */

Source from the content-addressed store, hash-verified

476 * "a genuine subdirectory of one". Output is capped: we only care whether the
477 * first byte exists, never what it is. */
478static watcher_git_status_t git_tracks_anything_here(cbm_watcher_t *w, project_state_t *state,
479 bool *tracked_out) {
480 *tracked_out = false;
481 const char *argv[] = {"git", "-C", state->root_path, "ls-files", "-z", "--", ".", NULL};
482 watcher_git_output_t output;
483 watcher_git_status_t status = watcher_git_run(w, state, argv, WATCHER_GIT_HEAD_MAX, &output);
484 if (status != WATCHER_GIT_OK) {
485 return status;
486 }
487 FILE *fp = cbm_fopen(output.path, "rb");
488 if (fp) {
489 *tracked_out = fgetc(fp) != EOF;
490 (void)fclose(fp);
491 }
492 watcher_git_output_cleanup(&output);
493 return fp ? WATCHER_GIT_OK : WATCHER_GIT_SUPERVISION_FAILED;
494}
495
496/* Relative hop from root_path up to the repository root, as `git rev-parse
497 * --show-cdup` reports it ("" at the root, "../" one level down, and so on).

Callers 1

init_baselineFunction · 0.85

Calls 3

watcher_git_runFunction · 0.85
cbm_fopenFunction · 0.85

Tested by

no test coverage detected