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

Function check_tree_changes

src/watcher/watcher.c:1435–1449  ·  view source on GitHub ↗

Check if a project has changes. Returns true if reindex needed. * Must NOT mutate the committed baselines (last_head, last_dirty_sig): * poll_project commits them only after a SUCCESSFUL reindex so that * busy-skips and failed runs retry instead of silently losing the change * (#937). Observations are staged in the pending_* fields. */ Non-git leg of check_changes (#1948). A failed walk report

Source from the content-addressed store, hash-verified

1433/* Non-git leg of check_changes (#1948). A failed walk reports "no verdict"
1434 * (false) so the committed baseline is kept and a later poll retries. */
1435static bool check_tree_changes(project_state_t *s, bool *changed_out) {
1436 uint64_t sig = 0;
1437 int file_count = 0;
1438 if (!tree_signature(s->root_path, &sig, &file_count)) {
1439 cbm_log_warn("watcher.tree_walk_failed", "project", s->project_name, "path", s->root_path);
1440 /* Retry at the regular cadence, not on every run-loop tick. */
1441 s->next_poll_ns = now_ns() + ((int64_t)s->interval_ms * US_PER_MS);
1442 return false;
1443 }
1444 s->pending_tree_sig = sig;
1445 s->file_count = file_count;
1446 s->interval_ms = cbm_watcher_poll_interval_ms(file_count);
1447 *changed_out = sig != s->last_tree_sig;
1448 return true;
1449}
1450
1451static bool check_changes(cbm_watcher_t *w, project_state_t *s, bool *changed_out) {
1452 if (!changed_out) {

Callers 1

check_changesFunction · 0.85

Calls 3

tree_signatureFunction · 0.85
now_nsFunction · 0.70

Tested by

no test coverage detected