1
0
Fork 0
mirror of https://github.com/archtechx/todo-system.git synced 2025-12-12 17:14:03 +00:00

finalize gitignore logic

This commit is contained in:
Samuel Štancl 2023-11-24 19:33:11 +01:00
parent 0d0795dcaa
commit ea399a9c3b

View file

@ -212,9 +212,7 @@ pub fn scan_dir(dir: &Path, entries: &mut Vec<Entry>, excludes: &mut Vec<PathBuf
// `add_excludes_from_gitignore` can add the *entire* directory being scanned here to excludes // `add_excludes_from_gitignore` can add the *entire* directory being scanned here to excludes
// e.g. if it contains a `*` line. Tthe directory is visited first, and gitignore is read second, // e.g. if it contains a `*` line. Tthe directory is visited first, and gitignore is read second,
// so the exclude would not affect anything inside the for loop. For that reason, we re-check if // so the exclude would not affect anything inside the for loop. For that reason, we re-check if
// `dir` isn't excluded after running `add_excludes_from_gitignore`. // `dir` hasn't become excluded after running `add_excludes_from_gitignore`.
// todo@real see if we can optimize this by checking for parent-child in the `for exclude` loop within 'entry
for exclude in &*excludes { for exclude in &*excludes {
if canonicalize(dir.to_path_buf()).unwrap() == *exclude { if canonicalize(dir.to_path_buf()).unwrap() == *exclude {
return Ok(()); return Ok(());