From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D65546DE01E3 for ; Sun, 29 Apr 2018 16:19:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QofiCXKdfRgi for ; Sun, 29 Apr 2018 16:19:51 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id C8A4C6DE01DB for ; Sun, 29 Apr 2018 16:19:51 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1fCvbh-0008RG-PU; Sun, 29 Apr 2018 19:19:49 -0400 Received: (nullmailer pid 21825 invoked by uid 1000); Sun, 29 Apr 2018 23:19:48 -0000 From: David Bremner To: Jani Nikula , David Bremner , notmuch@notmuchmail.org Subject: [PATCH 1/4] CLI/new: add full-scan option Date: Sun, 29 Apr 2018 20:19:40 -0300 Message-Id: <20180429231943.21780-1-david@tethera.net> X-Mailer: git-send-email 2.17.0 In-Reply-To: <874lju7zmv.fsf@nikula.org> References: <874lju7zmv.fsf@nikula.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Apr 2018 23:19:52 -0000 By default notmuch-new uses directory mtimes to optimize the scanning of directories for new mail. This option allows turning that optimization off e.g. for testing or debugging. --- notmuch-new.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index c4345705..6a54a1a1 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -47,6 +47,7 @@ typedef struct { int output_is_a_tty; enum verbosity verbosity; bool debug; + bool full_scan; const char **new_tags; size_t new_tags_length; const char **ignore_verbatim; @@ -527,7 +528,7 @@ add_files (notmuch_database_t *notmuch, * mistakenly return the total number of directory entries, since * that only inflates the count beyond 2. */ - if (directory && fs_mtime == db_mtime && st.st_nlink == 2) { + if (directory && (! state->full_scan) && fs_mtime == db_mtime && st.st_nlink == 2) { /* There's one catch: pass 1 below considers symlinks to * directories to be directories, but these don't increase the * file system link count. So, only bail early if the @@ -618,7 +619,7 @@ add_files (notmuch_database_t *notmuch, * being discovered until the clock catches up and the directory * is modified again). */ - if (directory && fs_mtime == db_mtime) + if (directory && (! state->full_scan) && fs_mtime == db_mtime) goto DONE; /* If the database has never seen this directory before, we can @@ -1053,6 +1054,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) add_files_state_t add_files_state = { .verbosity = VERBOSITY_NORMAL, .debug = false, + .full_scan = false, .output_is_a_tty = isatty (fileno (stdout)), }; struct timeval tv_start; @@ -1073,6 +1075,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) { .opt_bool = &quiet, .name = "quiet" }, { .opt_bool = &verbose, .name = "verbose" }, { .opt_bool = &add_files_state.debug, .name = "debug" }, + { .opt_bool = &add_files_state.full_scan, .name = "full-scan" }, { .opt_bool = &hooks, .name = "hooks" }, { .opt_inherit = notmuch_shared_indexing_options }, { .opt_inherit = notmuch_shared_options }, -- 2.17.0