Check if a project has changes. Returns true if reindex needed. */
| 510 | |
| 511 | /* Check if a project has changes. Returns true if reindex needed. */ |
| 512 | static bool check_changes(project_state_t *s) { |
| 513 | if (!s->is_git) { |
| 514 | return false; |
| 515 | } |
| 516 | |
| 517 | /* Check HEAD movement */ |
| 518 | char head[CBM_SZ_64] = {0}; |
| 519 | if (git_head(s->root_path, head, sizeof(head)) == 0) { |
| 520 | if (s->last_head[0] != '\0' && strcmp(head, s->last_head) != 0) { |
| 521 | /* HEAD moved — commit, checkout, pull */ |
| 522 | strncpy(s->last_head, head, sizeof(s->last_head) - 1); |
| 523 | return true; |
| 524 | } |
| 525 | strncpy(s->last_head, head, sizeof(s->last_head) - 1); |
| 526 | } |
| 527 | |
| 528 | /* Check working tree */ |
| 529 | return git_is_dirty(s->root_path); |
| 530 | } |
| 531 | |
| 532 | /* Context for poll_once foreach callback */ |
| 533 | typedef struct { |
no test coverage detected