X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=notmuch-new.c;h=c4b7da38afe07ede1b998cd082298f9f2f75577a;hb=7c450905e41d9bc81aca82f4593a5b42a4bb8e31;hp=4f3e52fb455832398a7940d0dc4ec80448155334;hpb=38d82b07c4462d2b3e4bc1ad3d24586be348db1d;p=obsolete%2Fnotmuch-old diff --git a/notmuch-new.c b/notmuch-new.c index 4f3e52fb..c4b7da38 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. */ @@ -411,13 +418,12 @@ add_files_recursive (notmuch_database_t *notmuch, /* success */ case NOTMUCH_STATUS_SUCCESS: state->added_messages++; + notmuch_message_freeze (message); for (tag=state->new_tags; *tag != NULL; tag++) notmuch_message_add_tag (message, *tag); - /* Defer sync of maildir flags until after old filenames - * are removed in the case of a rename. */ if (state->synchronize_flags == TRUE) - _filename_list_add (state->message_ids_to_sync, - notmuch_message_get_message_id (message)); + notmuch_message_maildir_flags_to_tags (message); + notmuch_message_thaw (message); break; /* Non-fatal issues (go on to next file) */ case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: