import should skip excluded directories

This commit is contained in:
Ajeet D'Souza 2026-06-30 11:11:59 +05:30
parent daa5c98112
commit 7a2094a59e
2 changed files with 11 additions and 3 deletions

View File

@ -11,9 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- POSIX: support for non-Cygwin Windows environments (e.g. Busybox).
- Support for RISC-V (riscv64) Linux.
- `import` now supports fetching entries from `atuin`.
- `import` now skips directories matching `$_ZO_EXCLUDE_DIRS`.
- POSIX: support for non-Cygwin Windows environments (e.g. Busybox).
- Fish: record the selected directory in shell history when using interactive
Space-Tab completions.
@ -24,8 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Bash/Fish/POSIX/Zsh: resolve symlinks on Windows.
- PowerShell: navigate to home directory with `z` on drives that don't define `HOME`.
- Bash: handle `$PROMPT_COMMAND` values ending in a semicolon.
- PowerShell: navigate to home directory with `z` on drives that don't define `HOME`.
- PowerShell: use fully qualified names when invoking cmdlets.
- Zsh: skip doctor diagnostics in non-interactive shells.
- Zsh: avoid inserting a trailing space when cancelling interactive Space-Tab completions.

View File

@ -49,12 +49,19 @@ pub(crate) struct ImportError {
/// rest of the import continues. After the iteration completes successfully,
/// the database is deduplicated and aged.
pub(crate) fn run(importer: &impl Importer, db: &mut Database) -> Result<()> {
let exclude_dirs = config::exclude_dirs()?;
let stderr = io::stderr();
let mut stderr = stderr.lock();
for entry in importer.dirs()? {
match entry {
Ok(dir) => db.add_unchecked(dir.path, dir.rank, dir.last_accessed),
Ok(dir) => {
if exclude_dirs.iter().any(|glob| glob.matches(&dir.path)) {
continue;
}
db.add_unchecked(dir.path, dir.rank, dir.last_accessed);
}
Err(e) => {
let location = match &e.path {
Some(path) => format!("{}:{}", path.display(), e.line_num),