mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 07:11:41 +01:00
CLI/new: add full-scan option
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.
This commit is contained in:
parent
51f3a0786f
commit
1c62e6d3a0
1 changed files with 5 additions and 2 deletions
|
@ -47,6 +47,7 @@ typedef struct {
|
||||||
int output_is_a_tty;
|
int output_is_a_tty;
|
||||||
enum verbosity verbosity;
|
enum verbosity verbosity;
|
||||||
bool debug;
|
bool debug;
|
||||||
|
bool full_scan;
|
||||||
const char **new_tags;
|
const char **new_tags;
|
||||||
size_t new_tags_length;
|
size_t new_tags_length;
|
||||||
const char **ignore_verbatim;
|
const char **ignore_verbatim;
|
||||||
|
@ -527,7 +528,7 @@ add_files (notmuch_database_t *notmuch,
|
||||||
* mistakenly return the total number of directory entries, since
|
* mistakenly return the total number of directory entries, since
|
||||||
* that only inflates the count beyond 2.
|
* 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
|
/* There's one catch: pass 1 below considers symlinks to
|
||||||
* directories to be directories, but these don't increase the
|
* directories to be directories, but these don't increase the
|
||||||
* file system link count. So, only bail early if 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
|
* being discovered until the clock catches up and the directory
|
||||||
* is modified again).
|
* is modified again).
|
||||||
*/
|
*/
|
||||||
if (directory && fs_mtime == db_mtime)
|
if (directory && (! state->full_scan) && fs_mtime == db_mtime)
|
||||||
goto DONE;
|
goto DONE;
|
||||||
|
|
||||||
/* If the database has never seen this directory before, we can
|
/* 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 = {
|
add_files_state_t add_files_state = {
|
||||||
.verbosity = VERBOSITY_NORMAL,
|
.verbosity = VERBOSITY_NORMAL,
|
||||||
.debug = false,
|
.debug = false,
|
||||||
|
.full_scan = false,
|
||||||
.output_is_a_tty = isatty (fileno (stdout)),
|
.output_is_a_tty = isatty (fileno (stdout)),
|
||||||
};
|
};
|
||||||
struct timeval tv_start;
|
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 = &quiet, .name = "quiet" },
|
||||||
{ .opt_bool = &verbose, .name = "verbose" },
|
{ .opt_bool = &verbose, .name = "verbose" },
|
||||||
{ .opt_bool = &add_files_state.debug, .name = "debug" },
|
{ .opt_bool = &add_files_state.debug, .name = "debug" },
|
||||||
|
{ .opt_bool = &add_files_state.full_scan, .name = "full-scan" },
|
||||||
{ .opt_bool = &hooks, .name = "hooks" },
|
{ .opt_bool = &hooks, .name = "hooks" },
|
||||||
{ .opt_inherit = notmuch_shared_indexing_options },
|
{ .opt_inherit = notmuch_shared_indexing_options },
|
||||||
{ .opt_inherit = notmuch_shared_options },
|
{ .opt_inherit = notmuch_shared_options },
|
||||||
|
|
Loading…
Reference in a new issue