diff --git a/lib/index/mu-indexer.cc b/lib/index/mu-indexer.cc index 8a44e516..9a43316e 100644 --- a/lib/index/mu-indexer.cc +++ b/lib/index/mu-indexer.cc @@ -115,12 +115,16 @@ Indexer::Private::handler (const std::string& fullpath, struct stat *statbuf, Scanner::HandleType htype) { switch (htype) { - case Scanner::HandleType::EnterDir: { + case Scanner::HandleType::EnterDir: + case Scanner::HandleType::EnterNewCur: { // in lazy-mode, we ignore this dir if its dirstamp suggest it // is up-to-date (this is _not_ always true; hence we call it - // lazy-mode) + // lazy-mode); only for actual message dirs, since the dir + // tstamps may not bubble up. dirstamp_ = store_.dirstamp(fullpath); - if (conf_.lazy_check && dirstamp_ == statbuf->st_mtime) { + if (conf_.lazy_check && + dirstamp_ == statbuf->st_mtime && + htype == Scanner::HandleType::EnterNewCur) { g_debug("skip %s (seems up-to-date)", fullpath.c_str()); return false; } diff --git a/lib/index/mu-scanner.cc b/lib/index/mu-scanner.cc index 65746ea9..dc714c9a 100644 --- a/lib/index/mu-scanner.cc +++ b/lib/index/mu-scanner.cc @@ -96,14 +96,15 @@ Scanner::Private::process_dentry (const std::string& path, struct dirent *dentry } if (S_ISDIR(statbuf.st_mode)) { - - const auto res = handler_(fullpath, &statbuf, Scanner::HandleType::EnterDir); - if (!res) { - //g_debug ("skipping dir %s", fullpath.c_str()); + const auto new_cur = is_new_cur(dentry->d_name); + const auto htype = new_cur ? + Scanner::HandleType::EnterNewCur : + Scanner::HandleType::EnterDir; + const auto res = handler_(fullpath, &statbuf, htype); + if (!res) return true; // skip - } - process_dir (fullpath, is_new_cur(dentry->d_name)); + process_dir (fullpath, new_cur); return handler_(fullpath, &statbuf, Scanner::HandleType::LeaveDir); diff --git a/lib/index/mu-scanner.hh b/lib/index/mu-scanner.hh index 3dc1fcca..1b0d6c48 100644 --- a/lib/index/mu-scanner.hh +++ b/lib/index/mu-scanner.hh @@ -42,7 +42,12 @@ namespace Mu { /// class Scanner { public: - enum struct HandleType { File, EnterDir, LeaveDir }; + enum struct HandleType { + File, + EnterNewCur, /* cur/ or new/ */ + EnterDir, /* some other directory */ + LeaveDir + }; /// Prototype for a handler function using Handler = std::function