1 /* Copyright 2016-present Facebook, Inc. 2 * Licensed under the Apache License, Version 2.0 */ 3 4 #ifndef WATCHMAN_IGNORE_H 5 #define WATCHMAN_IGNORE_H 6 7 #include <unordered_set> 8 #include "thirdparty/libart/src/art.h" 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 struct watchman_ignore { 15 /* if the map has an entry for a given dir, we're ignoring it */ 16 std::unordered_set<w_string> ignore_vcs; 17 std::unordered_set<w_string> ignore_dirs; 18 /* radix tree containing the same information as the ignore 19 * entries above. This is used only on OS X and Windows because 20 * we cannot exclude these dirs using the kernel watching APIs */ 21 art_tree<uint8_t, w_string> tree; 22 /* On OS X, we need to preserve the order of the ignore list so 23 * that we can exclude things deterministically and fit within 24 * system limits. */ 25 std::vector<w_string> dirs_vec; 26 27 // Adds a string to the ignore list. 28 // The is_vcs_ignore parameter indicates whether it is a full ignore 29 // or a vcs-style grandchild ignore. 30 void add(const w_string& path, bool is_vcs_ignore); 31 32 // Tests whether path is ignored. 33 // Returns true if the path is ignored, false otherwise. 34 bool isIgnored(const char* path, uint32_t pathlen) const; 35 36 // Test whether path is listed in ignore vcs config 37 bool isIgnoreVCS(const w_string& path) const; 38 39 // Test whether path is listed in ignore dir config 40 bool isIgnoreDir(const w_string& path) const; 41 }; 42 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 #endif 49 50 /* vim:ts=2:sw=2:et: 51 */ 52