diff --git a/crates/typos-cli/src/bin/typos-cli/main.rs b/crates/typos-cli/src/bin/typos-cli/main.rs index 81e4d35..9dd8773 100644 --- a/crates/typos-cli/src/bin/typos-cli/main.rs +++ b/crates/typos-cli/src/bin/typos-cli/main.rs @@ -241,20 +241,18 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult { walk.sort_by_file_name(|a, b| a.cmp(b)); } if !walk_policy.extend_exclude.is_empty() { - let mut overrides = ignore::overrides::OverrideBuilder::new("."); + let mut ignores = ignore::gitignore::GitignoreBuilder::new("."); for pattern in walk_policy.extend_exclude.iter() { - overrides - .add(pattern) + ignores + .add_line(None, pattern) .with_code(proc_exit::sysexits::CONFIG_ERR)?; } - let overrides = overrides - .build() - .with_code(proc_exit::sysexits::CONFIG_ERR)?; + let ignores = ignores.build().with_code(proc_exit::sysexits::CONFIG_ERR)?; if args.force_exclude { let mut ancestors = path.ancestors().collect::>(); ancestors.reverse(); for path in ancestors { - match overrides.matched(path, path.is_dir()) { + match ignores.matched(path, path.is_dir()) { ignore::Match::None => {} ignore::Match::Ignore(_) => continue 'path, ignore::Match::Whitelist(_) => break, @@ -264,12 +262,12 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult { walk.filter_entry(move |entry| { let path = entry.path(); let is_dir = entry.file_type().map(|t| t.is_dir()).unwrap_or(false); - let matched = overrides.matched(path, is_dir); + let matched = ignores.matched(path, is_dir); log::debug!("match({path:?}, {is_dir}) == {matched:?}"); match matched { ignore::Match::None => true, - ignore::Match::Ignore(_) => true, - ignore::Match::Whitelist(_) => false, + ignore::Match::Ignore(_) => false, + ignore::Match::Whitelist(_) => true, } }); }