fsmonitor: add documentation for the fsmonitor extension.
[git/debian.git] / fsmonitor.h
blob0de644e01aaea7e6082dc5b63015d498f324d271
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 * Write the CE_FSMONITOR_VALID state into the fsmonitor index extension.
15 extern void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate);
18 * Add/remove the fsmonitor index extension
20 extern void add_fsmonitor(struct index_state *istate);
21 extern void remove_fsmonitor(struct index_state *istate);
24 * Add/remove the fsmonitor index extension as necessary based on the current
25 * core.fsmonitor setting.
27 extern void tweak_fsmonitor(struct index_state *istate);
30 * Run the configured fsmonitor integration script and clear the
31 * CE_FSMONITOR_VALID bit for any files returned as dirty. Also invalidate
32 * any corresponding untracked cache directory structures. Optimized to only
33 * run the first time it is called.
35 extern void refresh_fsmonitor(struct index_state *istate);
38 * Set the given cache entries CE_FSMONITOR_VALID bit. This should be
39 * called any time the cache entry has been updated to reflect the
40 * current state of the file on disk.
42 static inline void mark_fsmonitor_valid(struct cache_entry *ce)
44 if (core_fsmonitor) {
45 ce->ce_flags |= CE_FSMONITOR_VALID;
46 trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_clean '%s'", ce->name);
51 * Clear the given cache entry's CE_FSMONITOR_VALID bit and invalidate
52 * any corresponding untracked cache directory structures. This should
53 * be called any time git creates or modifies a file that should
54 * trigger an lstat() or invalidate the untracked cache for the
55 * corresponding directory
57 static inline void mark_fsmonitor_invalid(struct index_state *istate, struct cache_entry *ce)
59 if (core_fsmonitor) {
60 ce->ce_flags &= ~CE_FSMONITOR_VALID;
61 untracked_cache_invalidate_path(istate, ce->name);
62 trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_invalid '%s'", ce->name);
66 #endif