THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.4KB

  1. #ifndef FSMONITOR_H
  2. #define FSMONITOR_H
  3. #include "cache.h"
  4. #include "dir.h"
  5. extern struct trace_key trace_fsmonitor;
  6. /*
  7. * Read the fsmonitor index extension and (if configured) restore the
  8. * CE_FSMONITOR_VALID state.
  9. */
  10. int read_fsmonitor_extension(struct index_state *istate, const void *data, unsigned long sz);
  11. /*
  12. * Fill the fsmonitor_dirty ewah bits with their state from the index,
  13. * before it is split during writing.
  14. */
  15. void fill_fsmonitor_bitmap(struct index_state *istate);
  16. /*
  17. * Write the CE_FSMONITOR_VALID state into the fsmonitor index
  18. * extension. Reads from the fsmonitor_dirty ewah in the index.
  19. */
  20. void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate);
  21. /*
  22. * Add/remove the fsmonitor index extension
  23. */
  24. void add_fsmonitor(struct index_state *istate);
  25. void remove_fsmonitor(struct index_state *istate);
  26. /*
  27. * Add/remove the fsmonitor index extension as necessary based on the current
  28. * core.fsmonitor setting.
  29. */
  30. void tweak_fsmonitor(struct index_state *istate);
  31. /*
  32. * Run the configured fsmonitor integration script and clear the
  33. * CE_FSMONITOR_VALID bit for any files returned as dirty. Also invalidate
  34. * any corresponding untracked cache directory structures. Optimized to only
  35. * run the first time it is called.
  36. */
  37. void refresh_fsmonitor(struct index_state *istate);
  38. /*
  39. * Set the given cache entries CE_FSMONITOR_VALID bit. This should be
  40. * called any time the cache entry has been updated to reflect the
  41. * current state of the file on disk.
  42. */
  43. static inline void mark_fsmonitor_valid(struct index_state *istate, struct cache_entry *ce)
  44. {
  45. if (core_fsmonitor && !(ce->ce_flags & CE_FSMONITOR_VALID)) {
  46. istate->cache_changed = 1;
  47. ce->ce_flags |= CE_FSMONITOR_VALID;
  48. trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_clean '%s'", ce->name);
  49. }
  50. }
  51. /*
  52. * Clear the given cache entry's CE_FSMONITOR_VALID bit and invalidate
  53. * any corresponding untracked cache directory structures. This should
  54. * be called any time git creates or modifies a file that should
  55. * trigger an lstat() or invalidate the untracked cache for the
  56. * corresponding directory
  57. */
  58. static inline void mark_fsmonitor_invalid(struct index_state *istate, struct cache_entry *ce)
  59. {
  60. if (core_fsmonitor) {
  61. ce->ce_flags &= ~CE_FSMONITOR_VALID;
  62. untracked_cache_invalidate_path(istate, ce->name, 1);
  63. trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_invalid '%s'", ce->name);
  64. }
  65. }
  66. #endif