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

Function sig_fold_path_stat

src/watcher/watcher.c:514–525  ·  view source on GitHub ↗

Fold a listed path's (size, mtime) into the signature so an in-place edit * of an already-dirty file still produces a new signature. A failed stat * (deleted file, quoting artifact) degrades to the entry text alone — the * deletion itself is represented by the porcelain status. */

Source from the content-addressed store, hash-verified

512 * (deleted file, quoting artifact) degrades to the entry text alone — the
513 * deletion itself is represented by the porcelain status. */
514static uint64_t sig_fold_path_stat(uint64_t h, const char *root_path, const char *rel) {
515 char abs[CBM_SZ_4K];
516 snprintf(abs, sizeof(abs), "%s/%s", root_path, rel);
517 struct stat st;
518 if (stat(abs, &st) == 0) {
519 int64_t mt = sig_stat_mtime_ns(&st);
520 int64_t sz = (int64_t)st.st_size;
521 h = sig_fold(h, &mt, sizeof(mt));
522 h = sig_fold(h, &sz, sizeof(sz));
523 }
524 return h;
525}
526
527/* Signature of the current dirty state: FNV-1a over the entries of
528 * `git status --porcelain -uall -z` plus each listed path's (size, mtime).

Callers 1

git_dirty_signatureFunction · 0.85

Calls 3

sig_stat_mtime_nsFunction · 0.85
sig_foldFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected