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