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. */
| 512 | * (deleted file, quoting artifact) degrades to the entry text alone — the |
| 513 | * deletion itself is represented by the porcelain status. */ |
| 514 | static 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). |
no test coverage detected