X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-new.c;h=cdf8513537f7a7c6eb19251f77695d1fc1e90a78;hp=4f3e52fb455832398a7940d0dc4ec80448155334;hb=600f3761dc48c91a5ba9a18ddeb7fd8af22e71de;hpb=38d82b07c4462d2b3e4bc1ad3d24586be348db1d diff --git a/notmuch-new.c b/notmuch-new.c index 4f3e52fb..cdf85135 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -308,9 +308,16 @@ add_files_recursive (notmuch_database_t *notmuch, next = NULL; } - /* If this directory hasn't been modified since the last - * "notmuch new", then we can skip the second pass entirely. */ - if (fs_mtime <= db_mtime) + /* If the directory's modification time in the filesystem is the + * same as what we recorded in the database the last time we + * scanned it, then we can skip the second pass entirely. + * + * We test for strict equality here to avoid a bug that can happen + * if the system clock jumps backward, (preventing new mail from + * being discovered until the clock catches up and the directory + * is modified again). + */ + if (fs_mtime == db_mtime) goto DONE; /* Pass 2: Scan for new files, removed files, and removed directories. */