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. * * cbm_path_info_utf8 rather than raw stat(): on Windows, stat()'s st_mtime * is SECOND-granularity, so two edits
| 659 | * onto root_path directly. cdup is "" when the project IS the repository root, |
| 660 | * which reduces this to the original join. */ |
| 661 | static uint64_t sig_fold_path_stat(uint64_t h, const char *root_path, const char *cdup, |
| 662 | const char *rel) { |
| 663 | char abs[CBM_SZ_4K]; |
| 664 | snprintf(abs, sizeof(abs), "%s/%s%s", root_path, cdup ? cdup : "", rel); |
| 665 | cbm_path_info_t info; |
| 666 | int rc = cbm_path_info_utf8(abs, &info); |
| 667 | if (rc != 0) { |
| 668 | cbm_usleep(1000); |
| 669 | rc = cbm_path_info_utf8(abs, &info); |
| 670 | } |
| 671 | if (rc == 0) { |
| 672 | h = sig_fold(h, &info.mtime_ns, sizeof(info.mtime_ns)); |
| 673 | h = sig_fold(h, &info.size, sizeof(info.size)); |
| 674 | } |
| 675 | return h; |
| 676 | } |
| 677 | |
| 678 | /* Signature of the current dirty state: FNV-1a over the entries of |
| 679 | * `git status --porcelain -uall -z` plus each listed path's (size, mtime). |
no test coverage detected