* The daemon can decorate directory events, such as a move or rename, * by adding a trailing slash to the observed name. Use this to * explicitly invalidate the entire cone under that directory. * * The daemon can only reliably do that if the OS FSEvent contains * sufficient information in the event. * * macOS FSEvents have enough information. * * Other platforms may or may not be able t
| 404 | * untracked or case-incorrect. |
| 405 | */ |
| 406 | static size_t handle_path_with_trailing_slash( |
| 407 | struct index_state *istate, const char *name, int pos) |
| 408 | { |
| 409 | int i; |
| 410 | size_t nr_in_cone = 0; |
| 411 | |
| 412 | /* |
| 413 | * Mark the untracked cache dirty for this directory path |
| 414 | * (regardless of whether or not we find an exact match for it |
| 415 | * in the index or find it to be proper prefix of one or more |
| 416 | * files in the index), since the FSEvent is hinting that |
| 417 | * there may be changes on or within the directory. |
| 418 | */ |
| 419 | untracked_cache_invalidate_trimmed_path(istate, name, 0); |
| 420 | |
| 421 | if (pos < 0) |
| 422 | pos = -pos - 1; |
| 423 | |
| 424 | /* Mark all entries for the folder invalid */ |
| 425 | for (i = pos; i < istate->cache_nr; i++) { |
| 426 | if (!starts_with(istate->cache[i]->name, name)) |
| 427 | break; |
| 428 | invalidate_ce_fsm(istate->cache[i]); |
| 429 | nr_in_cone++; |
| 430 | } |
| 431 | |
| 432 | return nr_in_cone; |
| 433 | } |
| 434 | |
| 435 | static void fsmonitor_refresh_callback(struct index_state *istate, char *name) |
| 436 | { |
no test coverage detected