44#include <unordered_map>
98 void load(
const std::filesystem::path& root);
109 const std::filesystem::path& base = {});
148 return regex_evals_.load(std::memory_order_relaxed);
157 regex_evals_.store(0, std::memory_order_relaxed);
209 static Rule compile_pattern(
const std::string&
pattern,
210 const std::string& base);
223 static std::string pattern_to_regex(
const std::string&
pattern);
232 void load_file(
const std::filesystem::path& path,
233 const std::string& base);
248 void load_nested_gitignores(
const std::filesystem::path&
canonical_root,
249 const std::filesystem::path&
root_gi);
263 void visit_discovery_entry(
264 std::filesystem::recursive_directory_iterator&
it,
266 const std::filesystem::path&
root_gi);
278 bool prunes_discovery(
279 const std::filesystem::path&
dir,
292 void push_rule(
Rule&& rule);
294 std::vector<Rule> rules_;
301 std::unordered_map<std::string, std::vector<std::size_t>> by_base_;
304 mutable std::atomic<std::uint64_t> regex_evals_{0};
gitignore-style path matcher (#15, v2.1.4).
static bool is_skipped_dir_name(const std::string &name)
Directory names never walked, by name alone (gh#161).
void load(const std::filesystem::path &root)
Load gitignore + explorerignore from a workspace root.
void add_pattern(const std::string &pattern, const std::filesystem::path &base={})
Add a single pattern programmatically (test surface).
std::uint64_t regex_evals() const
Regex evaluations performed since the last reset (gh#161).
bool is_ignored(const std::string &rel_path, bool is_dir) const
Test whether a path is ignored.
IgnoreMatcher()=default
Construct an empty matcher (no rules).
void reset_regex_evals() const
Reset the regex-evaluation counter (gh#161, test surface).
std::size_t rule_count() const
Number of compiled rules (test surface).
Activate model on GPU (WARM → ACTIVE).
@ optional
optional: every escape asks the host's path approver
One compiled gitignore rule (public so internal helpers in the .cpp can construct Rules without frien...
std::regex re_under
Path is strictly below target.
std::string base
Anchor base, "" means root.
bool dir_only
Trailing / (directory match)
std::string original
Raw pattern for diagnostics.
std::regex re_exact
Path equals pattern target.