Merge branch 'sb/string-list-remove-unused'
[git/debian.git] / fsmonitor.h
blob01017c43aa68be952ec6b89530fb5aa85c8a098b
1 #ifndef FSMONITOR_H
2 #define FSMONITOR_H
4 #include "cache.h"
5 #include "dir.h"
7 extern struct trace_key trace_fsmonitor;
9 /*
10 * Read the fsmonitor index extension and (if configured) restore the
11 * CE_FSMONITOR_VALID state.
13 extern int read_fsmonitor_extension(struct index_state *istate, const void *data, unsigned long sz);
16 * Fill the fsmonitor_dirty ewah bits with their state from the index,
17 * before it is split during writing.
19 extern void fill_fsmonitor_bitmap(struct index_state *istate);
22 * Write the CE_FSMONITOR_VALID state into the fsmonitor index
23 * extension. Reads from the fsmonitor_dirty ewah in the index.
25 extern void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate);
28 * Add/remove the fsmonitor index extension
30 extern void add_fsmonitor(struct index_state *istate);
31 extern void remove_fsmonitor(struct index_state *istate);
34 * Add/remove the fsmonitor index extension as necessary based on the current
35 * core.fsmonitor setting.
37 extern void tweak_fsmonitor(struct index_state *istate);
40 * Run the configured fsmonitor integration script and clear the
41 * CE_FSMONITOR_VALID bit for any files returned as dirty. Also invalidate
42 * any corresponding untracked cache directory structures. Optimized to only
43 * run the first time it is called.
45 extern void refresh_fsmonitor(struct index_state *istate);
48 * Set the given cache entries CE_FSMONITOR_VALID bit. This should be
49 * called any time the cache entry has been updated to reflect the
50 * current state of the file on disk.
52 static inline void mark_fsmonitor_valid(struct cache_entry *ce)
54 if (core_fsmonitor) {
55 ce->ce_flags |= CE_FSMONITOR_VALID;
56 trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_clean '%s'", ce->name);
61 * Clear the given cache entry's CE_FSMONITOR_VALID bit and invalidate
62 * any corresponding untracked cache directory structures. This should
63 * be called any time git creates or modifies a file that should
64 * trigger an lstat() or invalidate the untracked cache for the
65 * corresponding directory
67 static inline void mark_fsmonitor_invalid(struct index_state *istate, struct cache_entry *ce)
69 if (core_fsmonitor) {
70 ce->ce_flags &= ~CE_FSMONITOR_VALID;
71 untracked_cache_invalidate_path(istate, ce->name, 1);
72 trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_invalid '%s'", ce->name);
76 #endif