tests: use 'test_must_be_empty' instead of '! test -s'
[git/debian.git] / fsmonitor.h
blob65f37436369cd934f2bdb3b627396c5f72a7cb03
1 #ifndef FSMONITOR_H
2 #define FSMONITOR_H
4 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 extern int read_fsmonitor_extension(struct index_state *istate, const void *data, unsigned long sz);
13 * Fill the fsmonitor_dirty ewah bits with their state from the index,
14 * before it is split during writing.
16 extern void fill_fsmonitor_bitmap(struct index_state *istate);
19 * Write the CE_FSMONITOR_VALID state into the fsmonitor index
20 * extension. Reads from the fsmonitor_dirty ewah in the index.
22 extern void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate);
25 * Add/remove the fsmonitor index extension
27 extern void add_fsmonitor(struct index_state *istate);
28 extern void remove_fsmonitor(struct index_state *istate);
31 * Add/remove the fsmonitor index extension as necessary based on the current
32 * core.fsmonitor setting.
34 extern void tweak_fsmonitor(struct index_state *istate);
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.
42 extern void refresh_fsmonitor(struct index_state *istate);
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.
49 static inline void mark_fsmonitor_valid(struct cache_entry *ce)
51 if (core_fsmonitor) {
52 ce->ce_flags |= CE_FSMONITOR_VALID;
53 trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_clean '%s'", ce->name);
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
64 static inline void mark_fsmonitor_invalid(struct index_state *istate, struct cache_entry *ce)
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);
73 #endif